diff --git a/src/lib/app/mainapplication.cpp b/src/lib/app/mainapplication.cpp index 22dad30c2..031a83e9a 100644 --- a/src/lib/app/mainapplication.cpp +++ b/src/lib/app/mainapplication.cpp @@ -512,6 +512,11 @@ bool MainApplication::isClosing() const return m_isClosing; } +bool MainApplication::isRestoring() const +{ + return m_isRestoring; +} + bool MainApplication::isPrivateSession() const { return m_isPrivateSession; diff --git a/src/lib/app/mainapplication.h b/src/lib/app/mainapplication.h index 6e9e99d6e..fa29a1423 100644 --- a/src/lib/app/mainapplication.h +++ b/src/lib/app/mainapplication.h @@ -82,6 +82,7 @@ public: static MainApplication* getInstance() { return static_cast(QCoreApplication::instance()); } bool isClosing() const; + bool isRestoring() const; bool isPrivateSession() const; bool isStartingAfterCrash() const; int windowCount() const; diff --git a/src/lib/webview/webtab.cpp b/src/lib/webview/webtab.cpp index 9515313bf..ba30d3784 100644 --- a/src/lib/webview/webtab.cpp +++ b/src/lib/webview/webtab.cpp @@ -24,6 +24,7 @@ #include "locationbar.h" #include "qztools.h" #include "qzsettings.h" +#include "mainapplication.h" #include #include @@ -111,11 +112,12 @@ TabbedWebView* WebTab::view() const void WebTab::setCurrentTab() { if (!isRestored()) { - if (isVisible()) { - QTimer::singleShot(0, this, SLOT(slotRestore())); + // When session is being restored, restore the tab immediately + if (mApp->isRestoring()) { + slotRestore(); } else { - slotRestore(); + QTimer::singleShot(0, this, SLOT(slotRestore())); } } }