aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-01-08 10:45:00 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2014-01-11 10:20:28 +0100
commit9a2305a1b3075d110f4127a3d3c38b014237968a (patch)
tree051569c70130b803a6dee6f19b214e2a380cde4b /src
parent35ecf854c084c248ad640c6af030a9d1ed726c47 (diff)
qt: Stop shutdown detection timer during shutdown
Stop the shutdown timer from exiting the main loop when shutdown is already in progress. Fixes seeming hanging window after typing 'stop' in debug console. Also hide the debug console during shutdown as it is useless without a core to connect to.
Diffstat (limited to 'src')
-rw-r--r--src/qt/bitcoin.cpp5
-rw-r--r--src/qt/bitcoingui.cpp6
2 files changed, 9 insertions, 2 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index 098b17490e..45551657d7 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -193,6 +193,7 @@ private:
ClientModel *clientModel;
BitcoinGUI *window;
WalletModel *walletModel;
+ QTimer *pollShutdownTimer;
int returnValue;
void startThread();
@@ -250,6 +251,7 @@ BitcoinApplication::BitcoinApplication(int &argc, char **argv):
clientModel(0),
window(0),
walletModel(0),
+ pollShutdownTimer(0),
returnValue(0)
{
setQuitOnLastWindowClosed(false);
@@ -282,7 +284,7 @@ void BitcoinApplication::createWindow(bool isaTestNet)
{
window = new BitcoinGUI(isaTestNet, 0);
- QTimer* pollShutdownTimer = new QTimer(window);
+ pollShutdownTimer = new QTimer(window);
connect(pollShutdownTimer, SIGNAL(timeout()), window, SLOT(detectShutdown()));
pollShutdownTimer->start(200);
}
@@ -326,6 +328,7 @@ void BitcoinApplication::requestShutdown()
window->hide();
window->setClientModel(0);
window->removeAllWallets();
+ pollShutdownTimer->stop();
delete walletModel;
walletModel = 0;
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index f8daa08c4d..ee27fe90a6 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -855,7 +855,11 @@ void BitcoinGUI::toggleHidden()
void BitcoinGUI::detectShutdown()
{
if (ShutdownRequested())
- QMetaObject::invokeMethod(QCoreApplication::instance(), "quit", Qt::QueuedConnection);
+ {
+ if(rpcConsole)
+ rpcConsole->hide();
+ qApp->quit();
+ }
}
static bool ThreadSafeMessageBox(BitcoinGUI *gui, const std::string& message, const std::string& caption, unsigned int style)