diff --git a/src/lib/app/mainapplication.cpp b/src/lib/app/mainapplication.cpp index bc61ef51b..b48931aa4 100644 --- a/src/lib/app/mainapplication.cpp +++ b/src/lib/app/mainapplication.cpp @@ -93,7 +93,6 @@ MainApplication::MainApplication(int &argc, char** argv) , m_desktopNotifications(0) , m_webProfile(0) , m_autoSaver(0) - , m_lastActiveWindow(0) #if defined(Q_OS_WIN) && !defined(Q_OS_OS2) , m_registerQAppAssociation(0) #endif @@ -370,7 +369,7 @@ QList MainApplication::windows() const BrowserWindow* MainApplication::getWindow() const { if (m_lastActiveWindow) { - return m_lastActiveWindow; + return m_lastActiveWindow.data(); } return m_windows.isEmpty() ? 0 : m_windows.first(); diff --git a/src/lib/app/mainapplication.h b/src/lib/app/mainapplication.h index 0166134f4..52aa44c0f 100644 --- a/src/lib/app/mainapplication.h +++ b/src/lib/app/mainapplication.h @@ -21,6 +21,7 @@ #define mApp MainApplication::instance() #include +#include #include "qtsingleapplication/qtsingleapplication.h" #include "restoremanager.h" @@ -173,7 +174,7 @@ private: AutoSaver* m_autoSaver; QList m_windows; - BrowserWindow* m_lastActiveWindow; + QPointer m_lastActiveWindow; QList m_postLaunchActions;