plasma5-workspace/0001-shell-avoid-potential-crash-when-previous-window-is-.patch
Fabian Vogt b1def1a15b Accepting request 1102522 from home:fusionfuture:branches:KDE:Frameworks5
- Add patch to fix crash when closing popup on Wayland (kde#473054)
  * 0001-shell-avoid-potential-crash-when-previous-window-is-.patch

OBS-URL: https://build.opensuse.org/request/show/1102522
OBS-URL: https://build.opensuse.org/package/show/KDE:Frameworks5/plasma5-workspace?expand=0&rev=707
2023-08-06 10:05:52 +00:00

38 lines
1.2 KiB
Diff

From fc01a7f837d06ee9e92d02f13acb79c2b06e9e3c Mon Sep 17 00:00:00 2001
From: Fushan Wen <qydwhotmail@gmail.com>
Date: Fri, 4 Aug 2023 12:40:17 +0800
Subject: [PATCH] shell: avoid potential crash when previous window is gone
before returning focus
m_previousPlasmaWindow is bound to a window, and if a window is closed
before `restorePreviousWindow` is called, there will be a crash. Use
QPointer to track the window destruction.
---
shell/shellcorona.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/shell/shellcorona.h b/shell/shellcorona.h
index a3aff351a..db218d16e 100644
--- a/shell/shellcorona.h
+++ b/shell/shellcorona.h
@@ -14,6 +14,7 @@
#include <QDBusContext>
#include <QDBusVariant>
+#include <QPointer>
#include <QSet>
#include <QTimer>
@@ -301,7 +302,7 @@ private:
KWayland::Client::PlasmaShell *m_waylandPlasmaShell;
// For getting the active window on Wayland
KWayland::Client::PlasmaWindowManagement *m_waylandWindowManagement = nullptr;
- KWayland::Client::PlasmaWindow *m_previousPlasmaWindow = nullptr;
+ QPointer<KWayland::Client::PlasmaWindow> m_previousPlasmaWindow;
bool m_closingDown : 1;
bool m_screenReorderInProgress = false;
QString m_testModeLayout;
--
2.41.0.windows.3