qt: Avoid shutdownwindow-related memory leak

Store a reference to the shutdown window on BitcoinApplication,
so that it will be deleted when exiting the main loop.
This commit is contained in:
Wladimir J. van der Laan
2016-11-19 14:28:55 +01:00
committed by lateminer
parent df6a9014b7
commit e9c62ea15a
3 changed files with 10 additions and 6 deletions

View File

@@ -246,6 +246,7 @@ private:
#endif
int returnValue;
const PlatformStyle *platformStyle;
std::unique_ptr<QWidget> shutdownWindow;
void startThread();
};
@@ -410,6 +411,11 @@ void BitcoinApplication::requestInitialize(Config &config)
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.reset(ShutdownWindow::showShutdownWindow(window));
qDebug() << __func__ << ": Requesting shutdown";
startThread();
window->hide();