From aabc1626320624e55efefb44bc58430c232d5b7f Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 23 Oct 2023 22:12:37 +0300 Subject: [PATCH] x11: Unload effects before destroying Workspace and Compositor Effects can hold references to closed windows, which can cause problems after the workspace is destroyed. This change makes ApplicationX11 unload effects before destroying the Workspace and the Compositor similar to how it's done in main_wayland. BUG: 475511 --- src/main_x11.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main_x11.cpp b/src/main_x11.cpp index 3d89a6a599..db8e06b7a3 100644 --- a/src/main_x11.cpp +++ b/src/main_x11.cpp @@ -17,6 +17,7 @@ #include "core/outputbackend.h" #include "core/session.h" #include "cursor.h" +#include "effects.h" #include "outline.h" #include "screenedge.h" #include "sm.h" @@ -181,6 +182,10 @@ ApplicationX11::ApplicationX11(int &argc, char **argv) ApplicationX11::~ApplicationX11() { setTerminating(); + // need to unload all effects before destroying Workspace, as effects might call into Workspace + if (effects) { + static_cast(effects)->unloadAllEffects(); + } destroyPlugins(); destroyColorManager(); destroyWorkspace(); @@ -238,6 +243,10 @@ PlatformCursorImage ApplicationX11::cursorImage() const void ApplicationX11::lostSelection() { sendPostedEvents(); + // need to unload all effects before destroying Workspace, as effects might call into Workspace + if (effects) { + static_cast(effects)->unloadAllEffects(); + } destroyPlugins(); destroyColorManager(); destroyWorkspace();