From: CryptoManiac Date: Fri, 18 Jul 2014 15:48:33 +0000 (+0400) Subject: Fix segmentation fault during shutdown. X-Git-Tag: v0.4.4.6-nvc-update5^2~14 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=dc51de08660798825d497e79dfad8925c6d442c7 Fix segmentation fault during shutdown. --- diff --git a/src/checkqueue.h b/src/checkqueue.h index 36141dd..0ae4020 100644 --- a/src/checkqueue.h +++ b/src/checkqueue.h @@ -1,15 +1,17 @@ // Copyright (c) 2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. + #ifndef CHECKQUEUE_H #define CHECKQUEUE_H -#include -#include -#include - -#include #include +#include + +#include +#include +#include +#include template class CCheckQueueControl; diff --git a/src/init.cpp b/src/init.cpp index 9c65dab..40d5e3f 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -86,10 +86,6 @@ void Shutdown(void* parg) nTransactionsUpdated++; // CTxDB().Close(); bitdb.Flush(false); - { - LOCK(cs_main); - ThreadScriptCheckQuit(); - } StopNode(); bitdb.Flush(true); boost::filesystem::remove(GetPidFile()); @@ -880,7 +876,7 @@ bool AppInit2() if (file) LoadExternalBlockFile(file); } - exit(0); + StartShutdown(); } filesystem::path pathBootstrap = GetDataDir() / "bootstrap.dat"; diff --git a/src/net.cpp b/src/net.cpp index 13fbbdf..16439a7 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1895,6 +1895,10 @@ bool StopNode() fShutdown = true; nTransactionsUpdated++; int64 nStart = GetTime(); + { + LOCK(cs_main); + ThreadScriptCheckQuit(); + } if (semOutbound) for (int i=0; ipost(); @@ -1921,7 +1925,8 @@ bool StopNode() if (vnThreadsRunning[THREAD_ADDEDCONNECTIONS] > 0) printf("ThreadOpenAddedConnections still running\n"); if (vnThreadsRunning[THREAD_DUMPADDRESS] > 0) printf("ThreadDumpAddresses still running\n"); if (vnThreadsRunning[THREAD_MINTER] > 0) printf("ThreadStakeMinter still running\n"); - while (vnThreadsRunning[THREAD_MESSAGEHANDLER] > 0 || vnThreadsRunning[THREAD_RPCHANDLER] > 0) + if (vnThreadsRunning[THREAD_SCRIPTCHECK] > 0) printf("ThreadScriptCheck still running\n"); + while (vnThreadsRunning[THREAD_MESSAGEHANDLER] > 0 || vnThreadsRunning[THREAD_RPCHANDLER] > 0 || vnThreadsRunning[THREAD_SCRIPTCHECK] > 0) Sleep(20); Sleep(50); DumpAddresses();