summaryrefslogtreecommitdiff
path: root/kde-apps/konsole/files/konsole-21.04.3-emit-empty-in-SessionFinished-only-in-TabbedNavigation-mode.patch
blob: d02846ace5aa252a6678c08a4df463d5eee39323 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From 2684bc7fa5ac0b740b3e8661c3a0ae0136fde0a7 Mon Sep 17 00:00:00 2001
From: Ahmad Samir <a.samirh78@gmail.com>
Date: Sun, 22 Aug 2021 20:02:52 +0200
Subject: [PATCH] Only emit empty() in SessionFinished() when in
 TabbedNavigation mode

empty() is emitted so that MainWindow calls close() and we get rid of the
colours-flashing bug when closing the last session/tab in a window, see
commit bbec72250d080. However all that isn't relevant when we are in
konsole Part mode, where there are no tabs or MainWindows.

This fixes a crash in Dolphin when closing its window while the embedded
Konsole Part is open. The crash would happen as calling
ViewContainer::currentTabViewCount() would end up in the ViewSplitter code
path, which is no-op in Konsole Part.

To test:
- Open dolphin, make sure the terminal panel isn't open to begin with
- open the terminal panel
- close the dolphin window while the terminal panel is open

BUG: 441206
FIXED-IN: 21.08.1
---
 src/ViewManager.cpp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/ViewManager.cpp b/src/ViewManager.cpp
index 92d2951fc..2ba77e9f0 100644
--- a/src/ViewManager.cpp
+++ b/src/ViewManager.cpp
@@ -494,11 +494,13 @@ void ViewManager::sessionFinished()
         return;
     }
 
-    // The last session/tab, and only one view (no splits), emit empty()
-    // so that close() is called in MainWindow, fixes #432077
-    if (_viewContainer->count() == 1 && _viewContainer->currentTabViewCount() == 1) {
-        Q_EMIT empty();
-        return;
+    if (_navigationMethod == TabbedNavigation) {
+        // The last session/tab, and only one view (no splits), emit empty()
+        // so that close() is called in MainWindow, fixes #432077
+        if (_viewContainer->count() == 1 && _viewContainer->currentTabViewCount() == 1) {
+            Q_EMIT empty();
+            return;
+        }
     }
 
     auto *session = qobject_cast<Session *>(sender());
-- 
GitLab