Skip to content

Commit b003afb

Browse files
committed
wayfire-shell: fix #2212
1 parent 9248bee commit b003afb

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

plugins/protocols/wayfire-shell.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,18 @@ class wfs_output
312312
void create_hotspot(uint32_t hotspot, uint32_t threshold, uint32_t timeout,
313313
uint32_t id)
314314
{
315+
if (!this->output)
316+
{
317+
// It can happen that the client requests a hotspot immediately after an output is destroyed -
318+
// this is an inherent race condition because the compositor and client are not in sync.
319+
//
320+
// In this case, we create a dummy hotspot resource to avoid Wayland protocol errors.
321+
auto resource = wl_resource_create(
322+
wl_resource_get_client(this->resource), &zwf_hotspot_v2_interface, 1, id);
323+
wl_resource_set_implementation(resource, NULL, NULL, NULL);
324+
return;
325+
}
326+
315327
// will be auto-deleted when the resource is destroyed by the client
316328
new wfs_hotspot(this->output, hotspot, threshold, timeout,
317329
wl_resource_get_client(this->resource), id);

0 commit comments

Comments
 (0)