From b7bc20ae256d06e0d557273e2ed5a4ffbee3892b Mon Sep 17 00:00:00 2001 From: Kirill Primak Date: Wed, 26 Jun 2024 11:29:34 +0300 Subject: [PATCH] Destroy zwlr_layer_surface_v1 before wl_surface wayland.xml: "When a client wants to destroy a wl_surface, they must destroy this role object before the wl_surface, otherwise a defunct_role_object error is sent." Fixes: https://github.com/rcaelers/workrave/issues/550 --- ui/app/toolkits/gtkmm/BreakWindow.cc | 4 ++-- ui/app/toolkits/gtkmm/platforms/unix/WaylandWindowManager.cc | 4 ++++ ui/app/toolkits/gtkmm/platforms/unix/WaylandWindowManager.hh | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ui/app/toolkits/gtkmm/BreakWindow.cc b/ui/app/toolkits/gtkmm/BreakWindow.cc index 8e783acc3..f1bda703d 100644 --- a/ui/app/toolkits/gtkmm/BreakWindow.cc +++ b/ui/app/toolkits/gtkmm/BreakWindow.cc @@ -762,8 +762,6 @@ BreakWindow::stop() frame->set_frame_flashing(0); } - hide(); - #if defined(HAVE_WAYLAND) if (window_manager) { @@ -771,6 +769,8 @@ BreakWindow::stop() } #endif + hide(); + #if defined(PLATFORM_OS_WINDOWS) if (desktop_window != nullptr) { diff --git a/ui/app/toolkits/gtkmm/platforms/unix/WaylandWindowManager.cc b/ui/app/toolkits/gtkmm/platforms/unix/WaylandWindowManager.cc index da62f9202..3e1d1bf11 100644 --- a/ui/app/toolkits/gtkmm/platforms/unix/WaylandWindowManager.cc +++ b/ui/app/toolkits/gtkmm/platforms/unix/WaylandWindowManager.cc @@ -162,6 +162,10 @@ LayerSurface::LayerSurface(struct zwlr_layer_shell_v1 *layer_shell, wl_display_roundtrip(display); } +LayerSurface::~LayerSurface() { + zwlr_layer_surface_v1_destroy(this->layer_surface); +} + void LayerSurface::layer_surface_configure(void *data, struct zwlr_layer_surface_v1 *surface, diff --git a/ui/app/toolkits/gtkmm/platforms/unix/WaylandWindowManager.hh b/ui/app/toolkits/gtkmm/platforms/unix/WaylandWindowManager.hh index 7af03b372..780b50a68 100644 --- a/ui/app/toolkits/gtkmm/platforms/unix/WaylandWindowManager.hh +++ b/ui/app/toolkits/gtkmm/platforms/unix/WaylandWindowManager.hh @@ -30,7 +30,7 @@ class LayerSurface { public: LayerSurface(struct zwlr_layer_shell_v1 *layer_shell, Gtk::Widget &window, Glib::RefPtr monitor, bool keyboard_focus); - ~LayerSurface() = default; + ~LayerSurface(); private: static void layer_surface_configure(void *data,