From 56b28bfa1f57bc891192e4b64714be7e6d9d9071 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Sat, 30 Dec 2017 16:04:41 +0100 Subject: [PATCH] WebTab: Make sure to not call slotRestore multiple times It can happen when switching sessions and results in current tab being empty tab. --- src/lib/webtab/webtab.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/lib/webtab/webtab.cpp b/src/lib/webtab/webtab.cpp index 4a36e5603..9f5164ac1 100644 --- a/src/lib/webtab/webtab.cpp +++ b/src/lib/webtab/webtab.cpp @@ -467,23 +467,26 @@ void WebTab::slotRestore() { Q_ASSERT(m_tabBar); - p_restoreTab(m_savedTab); - m_savedTab.clear(); + if (isRestored()) { + return; + } + p_restoreTab(m_savedTab); m_tabBar->restoreTabTextColor(tabIndex()); + m_savedTab.clear(); } void WebTab::tabActivated() { + if (isRestored()) { + return; + } - if (!isRestored()) { - // When session is being restored, restore the tab immediately - if (mApp->isRestoring()) { - slotRestore(); - } - else { - QTimer::singleShot(0, this, SLOT(slotRestore())); - } + // When session is being restored, restore the tab immediately + if (mApp->isRestoring()) { + slotRestore(); + } else { + QTimer::singleShot(0, this, SLOT(slotRestore())); } }