Skip to content

Commit 9a2305a

Browse files
committed
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.
1 parent 35ecf85 commit 9a2305a

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/qt/bitcoin.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ public slots:
193193
ClientModel *clientModel;
194194
BitcoinGUI *window;
195195
WalletModel *walletModel;
196+
QTimer *pollShutdownTimer;
196197
int returnValue;
197198

198199
void startThread();
@@ -250,6 +251,7 @@ BitcoinApplication::BitcoinApplication(int &argc, char **argv):
250251
clientModel(0),
251252
window(0),
252253
walletModel(0),
254+
pollShutdownTimer(0),
253255
returnValue(0)
254256
{
255257
setQuitOnLastWindowClosed(false);
@@ -282,7 +284,7 @@ void BitcoinApplication::createWindow(bool isaTestNet)
282284
{
283285
window = new BitcoinGUI(isaTestNet, 0);
284286

285-
QTimer* pollShutdownTimer = new QTimer(window);
287+
pollShutdownTimer = new QTimer(window);
286288
connect(pollShutdownTimer, SIGNAL(timeout()), window, SLOT(detectShutdown()));
287289
pollShutdownTimer->start(200);
288290
}
@@ -326,6 +328,7 @@ void BitcoinApplication::requestShutdown()
326328
window->hide();
327329
window->setClientModel(0);
328330
window->removeAllWallets();
331+
pollShutdownTimer->stop();
329332

330333
delete walletModel;
331334
walletModel = 0;

src/qt/bitcoingui.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,11 @@ void BitcoinGUI::toggleHidden()
855855
void BitcoinGUI::detectShutdown()
856856
{
857857
if (ShutdownRequested())
858-
QMetaObject::invokeMethod(QCoreApplication::instance(), "quit", Qt::QueuedConnection);
858+
{
859+
if(rpcConsole)
860+
rpcConsole->hide();
861+
qApp->quit();
862+
}
859863
}
860864

861865
static bool ThreadSafeMessageBox(BitcoinGUI *gui, const std::string& message, const std::string& caption, unsigned int style)

0 commit comments

Comments
 (0)