From b003afbc34ae00ccb848f4395c63daa0c702d294 Mon Sep 17 00:00:00 2001 From: Ilia Bozhinov Date: Wed, 13 Mar 2024 11:47:45 +0100 Subject: [PATCH] wayfire-shell: fix #2212 --- plugins/protocols/wayfire-shell.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugins/protocols/wayfire-shell.cpp b/plugins/protocols/wayfire-shell.cpp index 2c8b994bf..ff9df252c 100644 --- a/plugins/protocols/wayfire-shell.cpp +++ b/plugins/protocols/wayfire-shell.cpp @@ -312,6 +312,18 @@ class wfs_output void create_hotspot(uint32_t hotspot, uint32_t threshold, uint32_t timeout, uint32_t id) { + if (!this->output) + { + // It can happen that the client requests a hotspot immediately after an output is destroyed - + // this is an inherent race condition because the compositor and client are not in sync. + // + // In this case, we create a dummy hotspot resource to avoid Wayland protocol errors. + auto resource = wl_resource_create( + wl_resource_get_client(this->resource), &zwf_hotspot_v2_interface, 1, id); + wl_resource_set_implementation(resource, NULL, NULL, NULL); + return; + } + // will be auto-deleted when the resource is destroyed by the client new wfs_hotspot(this->output, hotspot, threshold, timeout, wl_resource_get_client(this->resource), id);