diff --git a/src/composite.cpp b/src/composite.cpp index a31c82c850..57c2d825f1 100644 --- a/src/composite.cpp +++ b/src/composite.cpp @@ -152,8 +152,6 @@ Compositor::Compositor(QObject* workspace) Compositor::~Compositor() { - Q_EMIT aboutToDestroy(); - stop(); deleteUnusedSupportProperties(); destroyCompositorSelection(); s_compositor = nullptr; @@ -655,6 +653,12 @@ WaylandCompositor::WaylandCompositor(QObject *parent) this, &WaylandCompositor::destroyCompositorSelection); } +WaylandCompositor::~WaylandCompositor() +{ + Q_EMIT aboutToDestroy(); + stop(); // this can't be called in the destructor of Compositor +} + void WaylandCompositor::toggleCompositing() { // For the shortcut. Not possible on Wayland because we always composite. @@ -684,6 +688,12 @@ X11Compositor::X11Compositor(QObject *parent) } } +X11Compositor::~X11Compositor() +{ + Q_EMIT aboutToDestroy(); + stop(); // this can't be called in the destructor of Compositor +} + void X11Compositor::toggleCompositing() { if (m_suspended) { diff --git a/src/composite.h b/src/composite.h index f43a5254bc..5a44a792cf 100644 --- a/src/composite.h +++ b/src/composite.h @@ -143,11 +143,12 @@ private: QMap m_renderLoops; }; -class KWIN_EXPORT WaylandCompositor : public Compositor +class KWIN_EXPORT WaylandCompositor final : public Compositor { Q_OBJECT public: static WaylandCompositor *create(QObject *parent = nullptr); + ~WaylandCompositor() override; void toggleCompositing() override; @@ -158,7 +159,7 @@ private: explicit WaylandCompositor(QObject *parent); }; -class KWIN_EXPORT X11Compositor : public Compositor +class KWIN_EXPORT X11Compositor final : public Compositor { Q_OBJECT public: @@ -174,6 +175,7 @@ public: Q_FLAG(SuspendReasons) static X11Compositor *create(QObject *parent = nullptr); + ~X11Compositor() override; /** * @brief Suspends the Compositor if it is currently active.