From 99add01e76657ab7bc09d99c970b3ee08a0c9013 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Tue, 4 Jun 2013 23:44:53 -0400 Subject: [PATCH] osx: fix bitcoin-qt startup crash when clicking dock icon Crash probably introduced by 4d17a1b0. Inialize the window to NULL and verify it before use. --- src/qt/macdockiconhandler.mm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/qt/macdockiconhandler.mm b/src/qt/macdockiconhandler.mm index 53b49c42e..8f826941b 100644 --- a/src/qt/macdockiconhandler.mm +++ b/src/qt/macdockiconhandler.mm @@ -51,6 +51,7 @@ MacDockIconHandler::MacDockIconHandler() : QObject() this->m_dockIconClickEventHandler = [[DockIconClickEventHandler alloc] initWithDockIconHandler:this]; this->m_dummyWidget = new QWidget(); this->m_dockMenu = new QMenu(this->m_dummyWidget); + this->setMainWindow(NULL); [pool release]; } @@ -114,8 +115,11 @@ MacDockIconHandler *MacDockIconHandler::instance() void MacDockIconHandler::handleDockIconClickEvent() { - this->mainWindow->activateWindow(); - this->mainWindow->show(); + if (this->mainWindow) + { + this->mainWindow->activateWindow(); + this->mainWindow->show(); + } emit this->dockIconClicked(); }