Skip to content

Commit

Permalink
qt: Factor out requestNodeShutdown() slot
Browse files Browse the repository at this point in the history
  • Loading branch information
hebasto committed Sep 27, 2020
1 parent b3803a8 commit 2ed6cda
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/qt/bitcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,6 @@ void BitcoinApplication::requestShutdown()
// for example the RPC console may still be executing a command.
shutdownWindow.reset(ShutdownWindow::showShutdownWindow(window));

qDebug() << __func__ << ": Requesting shutdown";
startThread();
window->hideAll();
// Must disconnect node signals otherwise current thread can deadlock since
// no event loop is running.
Expand All @@ -352,8 +350,7 @@ void BitcoinApplication::requestShutdown()
delete clientModel;
clientModel = nullptr;

// Request shutdown from core thread
Q_EMIT requestedShutdown();
requestNodeShutdown();
}

void BitcoinApplication::initializeResult(bool success, interfaces::BlockAndHeaderTipInfo tip_info)
Expand Down Expand Up @@ -407,6 +404,14 @@ void BitcoinApplication::initializeResult(bool success, interfaces::BlockAndHead
}
}

void BitcoinApplication::requestNodeShutdown()
{
qDebug() << __func__ << ": Requesting shutdown";
startThread();
// Request shutdown from core thread
Q_EMIT requestedShutdown();
}

void BitcoinApplication::shutdownResult()
{
quit();
Expand Down
1 change: 1 addition & 0 deletions src/qt/bitcoin.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public Q_SLOTS:
void initializeResult(bool success, interfaces::BlockAndHeaderTipInfo tip_info);
/// Request core shutdown
void requestShutdown();
void requestNodeShutdown();
void shutdownResult();
/// Handle runaway exceptions. Shows a message box with the problem and quits the program.
void handleRunawayException(const QString &message);
Expand Down

0 comments on commit 2ed6cda

Please sign in to comment.