mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-23 21:39:13 +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:
@@ -511,6 +511,13 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel)
|
||||
// Disable context menu on tray icon
|
||||
trayIconMenu->clear();
|
||||
}
|
||||
// Propagate cleared model to child objects
|
||||
rpcConsole->setClientModel(nullptr);
|
||||
#ifdef ENABLE_WALLET
|
||||
walletFrame->setClientModel(nullptr);
|
||||
#endif // ENABLE_WALLET
|
||||
unitDisplayControl->setOptionsModel(nullptr);
|
||||
connectionsControl->setClientModel(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1242,7 +1249,5 @@ void NetworkToggleStatusBarControl::mousePressEvent(QMouseEvent *event)
|
||||
/** Lets the control know about the Client Model */
|
||||
void NetworkToggleStatusBarControl::setClientModel(ClientModel *_clientModel)
|
||||
{
|
||||
if (_clientModel) {
|
||||
this->clientModel = _clientModel;
|
||||
}
|
||||
this->clientModel = _clientModel;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user