[wayland] Ensure Compositor is destroyed early enough
If startup fails and there is no Workspace the Compositor was destroyed as a child of Application with the result of being destroyed after the Wayland server resulting in a crash. If the Workspace gets created the Compositor will be destroyed by the Workspace, so there's no need to destroy it early.
This commit is contained in:
parent
d0e5e86a30
commit
604b6d05f5
3 changed files with 11 additions and 0 deletions
9
main.cpp
9
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;
|
||||
|
|
1
main.h
1
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.
|
||||
|
|
|
@ -73,6 +73,7 @@ ApplicationWayland::ApplicationWayland(int &argc, char **argv)
|
|||
|
||||
ApplicationWayland::~ApplicationWayland()
|
||||
{
|
||||
destroyCompositor();
|
||||
destroyWorkspace();
|
||||
if (x11Connection()) {
|
||||
Xcb::setInputFocus(XCB_INPUT_FOCUS_POINTER_ROOT);
|
||||
|
|
Loading…
Reference in a new issue