mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-04 04:45:10 +02:00
qt: Prevent thread/memory leak on exiting RPCConsole
Make ownership of the QThread object clear, so that the RPCConsole can wait for the executor thread to quit before shutdown is called. This increases overall thread safety, and prevents some objects from leaking on exit.
This commit is contained in:
@@ -409,6 +409,11 @@ void BitcoinApplication::requestInitialize()
|
||||
|
||||
void BitcoinApplication::requestShutdown()
|
||||
{
|
||||
// Show a simple window indicating shutdown status
|
||||
// Do this first as some of the steps may take some time below,
|
||||
// for example the RPC console may still be executing a command.
|
||||
ShutdownWindow::showShutdownWindow(window);
|
||||
|
||||
qDebug() << __func__ << ": Requesting shutdown";
|
||||
startThread();
|
||||
window->hide();
|
||||
@@ -423,9 +428,6 @@ void BitcoinApplication::requestShutdown()
|
||||
delete clientModel;
|
||||
clientModel = 0;
|
||||
|
||||
// Show a simple window indicating shutdown status
|
||||
ShutdownWindow::showShutdownWindow(window);
|
||||
|
||||
// Request shutdown from core thread
|
||||
Q_EMIT requestedShutdown();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user