From acb4336932c3f70335c1dcb9f4ae09ffcba9c63e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 28 Oct 2016 10:12:15 +0200 Subject: [PATCH] [plugins/qpa] Properly clean up the created KWayland::Client::Outputs On build.kde.org the autotests started to crash on tear down due to a newer Wayland library. The reason is that the KWayland::Client::Outputs are destroyed after the internal Wayland connection is destroyed. This change parents the created Outputs to the Registry like the other objects. To ensure that the KWin::QPA::Screen doesn't have a problem with that, it is changed to a QPointer - nullptr checks are already in place. Hopefully that will fix the crashes on build.kde.org, but there is a chance that more errors are hidden. --- plugins/qpa/integration.cpp | 2 +- plugins/qpa/screen.cpp | 3 ++- plugins/qpa/screen.h | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/qpa/integration.cpp b/plugins/qpa/integration.cpp index 555abcf821..8913bf0a1e 100644 --- a/plugins/qpa/integration.cpp +++ b/plugins/qpa/integration.cpp @@ -226,7 +226,7 @@ void Integration::createWaylandOutput(quint32 name, quint32 version) m_dummyScreen = nullptr; } using namespace KWayland::Client; - auto o = m_registry->createOutput(name, version, this); + auto o = m_registry->createOutput(name, version, m_registry); connect(o, &Output::changed, this, [this, o] { disconnect(o, &Output::changed, nullptr, nullptr); diff --git a/plugins/qpa/screen.cpp b/plugins/qpa/screen.cpp index 60687ee6c5..290e1eda0e 100644 --- a/plugins/qpa/screen.cpp +++ b/plugins/qpa/screen.cpp @@ -19,6 +19,7 @@ along with this program. If not, see . *********************************************************************/ #include "screen.h" #include "platformcursor.h" +#include "wayland_server.h" #include @@ -29,7 +30,7 @@ namespace QPA Screen::Screen(KWayland::Client::Output *o) : QPlatformScreen() - , m_output(o) + , m_output(QPointer(o)) , m_cursor(new PlatformCursor) { // TODO: connect to resolution changes diff --git a/plugins/qpa/screen.h b/plugins/qpa/screen.h index d7b98977d0..879ad06a27 100644 --- a/plugins/qpa/screen.h +++ b/plugins/qpa/screen.h @@ -21,6 +21,7 @@ along with this program. If not, see . #define KWIN_QPA_SCREEN_H #include +#include namespace KWayland { @@ -50,7 +51,7 @@ public: QDpi logicalDpi() const override; private: - KWayland::Client::Output *m_output; + QPointer m_output; QScopedPointer m_cursor; };