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:
Wladimir J. van der Laan
2016-11-18 16:35:14 +01:00
parent 47db075377
commit 693384eedb
4 changed files with 29 additions and 16 deletions

View File

@@ -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;
}