Blame SOURCES/0011-Client-Disconnect-registry-listener-on-destruction.patch

93bb3c
From a1d6aa2078b8a840469f13ae720669cb4f99291d Mon Sep 17 00:00:00 2001
429548
From: David Edmundson <davidedmundson@kde.org>
429548
Date: Fri, 14 May 2021 13:23:24 +0100
93bb3c
Subject: [PATCH 11/40] Client: Disconnect registry listener on destruction
429548
429548
If a display outlives a QWaylandClientExtension and a new global is
429548
announced we end up delivering an event to a now deleted extension which
429548
will crash.
429548
429548
Change-Id: Idc0de40be61a2f7627ab4963e1fe29b22fbf3f04
429548
(cherry picked from commit c4ba37cd2f8cb81b9438b56ac604fc2f3e45083c)
429548
---
429548
 src/client/global/qwaylandclientextension.cpp | 7 +++++++
429548
 src/client/global/qwaylandclientextension.h   | 1 +
429548
 2 files changed, 8 insertions(+)
429548
429548
diff --git a/src/client/global/qwaylandclientextension.cpp b/src/client/global/qwaylandclientextension.cpp
429548
index 125b1e19..797b06fe 100644
429548
--- a/src/client/global/qwaylandclientextension.cpp
429548
+++ b/src/client/global/qwaylandclientextension.cpp
429548
@@ -88,6 +88,13 @@ QWaylandClientExtension::QWaylandClientExtension(const int ver)
429548
     QMetaObject::invokeMethod(this, "addRegistryListener", Qt::QueuedConnection);
429548
 }
429548
 
429548
+QWaylandClientExtension::~QWaylandClientExtension()
429548
+{
429548
+    Q_D(QWaylandClientExtension);
429548
+    if (d->registered && !QCoreApplication::closingDown())
429548
+        d->waylandIntegration->display()->removeListener(&QWaylandClientExtensionPrivate::handleRegistryGlobal, this);
429548
+}
429548
+
429548
 QtWaylandClient::QWaylandIntegration *QWaylandClientExtension::integration() const
429548
 {
429548
     Q_D(const QWaylandClientExtension);
429548
diff --git a/src/client/global/qwaylandclientextension.h b/src/client/global/qwaylandclientextension.h
429548
index 98272e57..5bd28398 100644
429548
--- a/src/client/global/qwaylandclientextension.h
429548
+++ b/src/client/global/qwaylandclientextension.h
429548
@@ -63,6 +63,7 @@ class Q_WAYLAND_CLIENT_EXPORT QWaylandClientExtension : public QObject
429548
     Q_PROPERTY(bool active READ isActive NOTIFY activeChanged)
429548
 public:
429548
     QWaylandClientExtension(const int version);
429548
+    ~QWaylandClientExtension();
429548
 
429548
     QtWaylandClient::QWaylandIntegration *integration() const;
429548
     int version() const;
429548
-- 
93bb3c
2.35.1
429548