From 276cfd85304be27bb2c04c087c8f3ea25cb6f77d Mon Sep 17 00:00:00 2001 From: Philip Kaufmann Date: Mon, 11 Jun 2012 07:40:14 +0200 Subject: Bugfix: Fix various places where Bitcoin-Qt was being shutdown improperly (Partial/merge of upstream 9247134eaba9a1d0fa74f22de238af1476663005, 1a3f0da9229a8e524d1010cdc8bd3b9da71fe529, and 3e343522226e6c249f5cb05436eec347b87c6361) --- src/bitcoinrpc.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src/bitcoinrpc.cpp') diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index 92f2f9ec7..38f102e1a 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -165,7 +165,8 @@ Value stop(const Array& params, bool fHelp) "Stop bitcoin server."); #ifndef QT_GUI // Shutdown will take long enough that the response should get back - CreateThread(Shutdown, NULL); + // NOTE: This should actually work with Bitcoin-Qt too now, but 0.5.0 didn't allow it + StartShutdown(); return "bitcoin server stopping"; #else throw runtime_error("NYI: cannot shut down GUI with RPC command"); @@ -1587,7 +1588,7 @@ Value encryptwallet(const Array& params, bool fHelp) // BDB seems to have a bad habit of writing old data into // slack space in .dat files; that is bad if the old data is // unencrypted private keys. So: - CreateThread(Shutdown, NULL); + StartShutdown(); return "wallet encrypted; bitcoin server stopping, restart to run with encrypted wallet"; } @@ -2173,10 +2174,6 @@ void ThreadRPCServer(void* parg) printf("ThreadRPCServer exiting\n"); } -#ifdef QT_GUI -extern bool HACK_SHUTDOWN; -#endif - void ThreadRPCServer2(void* parg) { printf("ThreadRPCServer started\n"); @@ -2203,7 +2200,7 @@ void ThreadRPCServer2(void* parg) EncodeBase58(&rand_pwd[0],&rand_pwd[0]+32).c_str()), _("Error"), wxOK | wxMODAL); #ifndef QT_GUI - CreateThread(Shutdown, NULL); + StartShutdown(); #endif return; } @@ -2228,9 +2225,9 @@ void ThreadRPCServer2(void* parg) } catch(boost::system::system_error &e) { - HACK_SHUTDOWN = true; ThreadSafeMessageBox(strprintf(_("An error occured while setting up the RPC port %i for listening: %s"), endpoint.port(), e.what()), _("Error"), wxOK | wxMODAL); + StartShutdown(); return; } #endif -- cgit v1.2.3