diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2011-10-13 00:58:30 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2011-10-13 00:58:30 +0200 |
commit | 8302ea16430afc414807c5251f04f129172e8995 (patch) | |
tree | 36068218068c283a747c62c441c5769e79d66d29 /src/application.cpp | |
parent | Calm down kDebug messages (diff) | |
download | rekonq-8302ea16430afc414807c5251f04f129172e8995.tar.xz |
Fix crash on private mode store/restore
This commit, while does not perfectly fix the issue, "workaround" it
a lot to fix crashes on private mode enter/exit
- improve session store/restore
- improve session manager code
- calm down kDebug messages
- applies code style
CCBUG: 268328
Diffstat (limited to 'src/application.cpp')
-rw-r--r-- | src/application.cpp | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/application.cpp b/src/application.cpp index 39879e4c..6f9df43a 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -691,27 +691,38 @@ void Application::setPrivateBrowsingMode(bool b) return; } + sessionManager()->setSessionManagementEnabled(false); settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, true); _privateBrowsingAction->setChecked(true); + loadUrl(KUrl("about:home"), Rekonq::NewWindow); + + MainWindow *activeOne = m_mainWindows.at(0).data(); + Q_FOREACH(const QWeakPointer<MainWindow> &w, m_mainWindows) { - w.data()->close(); + if (w.data() != activeOne) + w.data()->close(); } - loadUrl(KUrl("about:home"), Rekonq::NewWindow); } else { - Q_FOREACH(const QWeakPointer<MainWindow> &w, m_mainWindows) - { - w.data()->close(); - } - settings->setAttribute(QWebSettings::PrivateBrowsingEnabled, false); _privateBrowsingAction->setChecked(false); - if (!sessionManager()->restoreSessionFromScratch()) + int newWindows = sessionManager()->restoreSavedSession(); + if (newWindows == 0) + { loadUrl(KUrl("about:home"), Rekonq::NewWindow); + newWindows++; + } + + for (int i = newWindows; i < m_mainWindows.count(); ++i) + { + m_mainWindows.at(i).data()->close(); + } + + sessionManager()->setSessionManagementEnabled(true); } } |