Properly destroy Compositor during teardown
When the aboutToDestroy signal is emitted, the compositor object is already partially destroyed. This contradicts to the name of the signal. In addition to that, it will be better to call the stop method in the destructors of X11Compositor and WaylandClient as it allows them to add custom cleanup code when compositing is turned off.
This commit is contained in:
parent
38f6494b2c
commit
047c1a91f2
2 changed files with 16 additions and 4 deletions
|
@ -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) {
|
||||
|
|
|
@ -143,11 +143,12 @@ private:
|
|||
QMap<RenderLoop *, AbstractOutput *> 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.
|
||||
|
|
Loading…
Reference in a new issue