Commit 656f6804 authored by Jiří Paleček's avatar Jiří Paleček Committed by Kurt Hindenburg

Fix the fallback code used when restoring session fails

Summary:
 When restoring session in Konsole fails, the fallback code should
 create a default view and session instead. However, the code omitted
 adding this view to the container, which makes

 - the window black (or grey in my case), see
   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=935031

 - konsole crash later, when you add a new tab and close it, because
   code in ViewManager expects TerminalDisplays to be children of
   ViewSplitter, which is not the case

 This fix adds the view to activeController(), just like every other
 code that creates TerminalDisplay.

Test Plan:
 1. find a session in your $HOME/.config/session/ from konsole before 19.08
 2. konsole -session xxxx (where xxxx are the numbers in the session file)
    -> there should be a konsole window with usable terminal
 3. add a new tab with C-S-T and close it
    ->there should be no crash

Reviewers: hindenburg, #konsole

Reviewed By: hindenburg, #konsole

Subscribers: tcanabrava, konsole-devel

Tags: #konsole

Differential Revision: https://phabricator.kde.org/D23601
parent 7e83be47
......@@ -938,7 +938,7 @@ void ViewManager::restoreSessions(const KConfigGroup &group)
if (jsonTabs.isEmpty()) { // Session file is unusable, start default Profile
Profile::Ptr profile = ProfileManager::instance()->defaultProfile();
Session *session = SessionManager::instance()->createSession(profile);
createView(session);
activeContainer()->addView(createView(session));
if (!session->isRunning()) {
session->run();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment