From 36b13e452d29640c275577617d69c8e7f17ecede Mon Sep 17 00:00:00 2001 From: Juraj Oravec Date: Thu, 23 Nov 2023 20:37:28 +0100 Subject: [PATCH] Fix crash when starting new session after crash BUG: 408701 FIXED-IN: 23.08.4 Signed-off-by: Juraj Oravec --- src/lib/session/recoveryjsobject.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/lib/session/recoveryjsobject.cpp b/src/lib/session/recoveryjsobject.cpp index 3097f3ce2..92dc01588 100644 --- a/src/lib/session/recoveryjsobject.cpp +++ b/src/lib/session/recoveryjsobject.cpp @@ -74,7 +74,18 @@ QJsonArray RecoveryJsObject::restoreData() const void RecoveryJsObject::startNewSession() { - closeTab(); + auto *view = qobject_cast(m_page->view()); + if (!view) { + return; + } + + if (view->browserWindow()->tabCount() > 1) { + view->closeView(); + } else { + auto *oldWindow = view->browserWindow(); + mApp->createWindow(Qz::BW_NewWindow); + oldWindow->close(); + } mApp->restoreManager()->clearRestoreData(); mApp->destroyRestoreManager();