diff --git a/xwl/xwayland.cpp b/xwl/xwayland.cpp index 06dca9725d..a24945e389 100644 --- a/xwl/xwayland.cpp +++ b/xwl/xwayland.cpp @@ -158,6 +158,7 @@ void Xwayland::stop() uninstallSocketNotifier(); DataBridge::destroy(); + m_selectionOwner.reset(); destroyX11Connection(); @@ -318,8 +319,8 @@ void Xwayland::handleXwaylandReady() qputenv("DISPLAY", m_displayName); // create selection owner for WM_S0 - magic X display number expected by XWayland - KSelectionOwner owner("WM_S0", kwinApp()->x11Connection(), kwinApp()->x11RootWindow()); - owner.claim(true); + m_selectionOwner.reset(new KSelectionOwner("WM_S0", kwinApp()->x11Connection(), kwinApp()->x11RootWindow())); + m_selectionOwner->claim(true); DataBridge::create(this); diff --git a/xwl/xwayland.h b/xwl/xwayland.h index 0254188e5b..274aafcf7c 100644 --- a/xwl/xwayland.h +++ b/xwl/xwayland.h @@ -16,6 +16,8 @@ #include #include +class KSelectionOwner; + namespace KWin { class ApplicationWaylandAbstract; @@ -105,6 +107,7 @@ private: QByteArray m_displayName; QFutureWatcher *m_watcher = nullptr; ApplicationWaylandAbstract *m_app; + QScopedPointer m_selectionOwner; int m_crashCount = 0; Q_DISABLE_COPY(Xwayland)