diff --git a/main.cpp b/main.cpp index b19fda3ccf..50700d6fc0 100644 --- a/main.cpp +++ b/main.cpp @@ -423,6 +423,15 @@ void Application::destroyWorkspace() delete Workspace::self(); } +void Application::destroyCompositor() +{ + if (Workspace::self()) { + // compositor is destroyed together with Workspace + return; + } + delete Compositor::self(); +} + void Application::updateX11Time(xcb_generic_event_t *event) { xcb_timestamp_t time = XCB_TIME_CURRENT_TIME; diff --git a/main.h b/main.h index 4a24766288..7dafc00670 100644 --- a/main.h +++ b/main.h @@ -166,6 +166,7 @@ protected: void createCompositor(); void setupEventFilters(); void destroyWorkspace(); + void destroyCompositor(); /** * Inheriting classes should use this method to set the X11 root window * before accessing any X11 specific code pathes. diff --git a/main_wayland.cpp b/main_wayland.cpp index 206ddfd501..d354736817 100644 --- a/main_wayland.cpp +++ b/main_wayland.cpp @@ -73,6 +73,7 @@ ApplicationWayland::ApplicationWayland(int &argc, char **argv) ApplicationWayland::~ApplicationWayland() { + destroyCompositor(); destroyWorkspace(); if (x11Connection()) { Xcb::setInputFocus(XCB_INPUT_FOCUS_POINTER_ROOT);