Browse Source

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.
0.10
Wladimir J. van der Laan 11 years ago
parent
commit
9a2305a1b3
  1. 5
      src/qt/bitcoin.cpp
  2. 6
      src/qt/bitcoingui.cpp

5
src/qt/bitcoin.cpp

@ -193,6 +193,7 @@ private:
ClientModel *clientModel; ClientModel *clientModel;
BitcoinGUI *window; BitcoinGUI *window;
WalletModel *walletModel; WalletModel *walletModel;
QTimer *pollShutdownTimer;
int returnValue; int returnValue;
void startThread(); void startThread();
@ -250,6 +251,7 @@ BitcoinApplication::BitcoinApplication(int &argc, char **argv):
clientModel(0), clientModel(0),
window(0), window(0),
walletModel(0), walletModel(0),
pollShutdownTimer(0),
returnValue(0) returnValue(0)
{ {
setQuitOnLastWindowClosed(false); setQuitOnLastWindowClosed(false);
@ -282,7 +284,7 @@ void BitcoinApplication::createWindow(bool isaTestNet)
{ {
window = new BitcoinGUI(isaTestNet, 0); window = new BitcoinGUI(isaTestNet, 0);
QTimer* pollShutdownTimer = new QTimer(window); pollShutdownTimer = new QTimer(window);
connect(pollShutdownTimer, SIGNAL(timeout()), window, SLOT(detectShutdown())); connect(pollShutdownTimer, SIGNAL(timeout()), window, SLOT(detectShutdown()));
pollShutdownTimer->start(200); pollShutdownTimer->start(200);
} }
@ -326,6 +328,7 @@ void BitcoinApplication::requestShutdown()
window->hide(); window->hide();
window->setClientModel(0); window->setClientModel(0);
window->removeAllWallets(); window->removeAllWallets();
pollShutdownTimer->stop();
delete walletModel; delete walletModel;
walletModel = 0; walletModel = 0;

6
src/qt/bitcoingui.cpp

@ -855,7 +855,11 @@ void BitcoinGUI::toggleHidden()
void BitcoinGUI::detectShutdown() void BitcoinGUI::detectShutdown()
{ {
if (ShutdownRequested()) 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) static bool ThreadSafeMessageBox(BitcoinGUI *gui, const std::string& message, const std::string& caption, unsigned int style)

Loading…
Cancel
Save