mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
wayland/outputs: Fix potential crash when output has no monitor
bind_output() creates output interface resource, but does not set implementation for it when wayland_output->monitor is NULL. However, when the wayland library is running wl_closure_invoke(), it expects the implementation to be non-NULL, and if not, it just segfaults mutter by NULL pointer dereference. This commit tries to address this issue by setting an implementation when wayland_output->monitor is NULL. This could help prevent crash when resuming from suspend or hotplugging displays. Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2570 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2827>
This commit is contained in:
parent
d8ef1b5b8b
commit
c1ab3f39d7
@ -317,7 +317,12 @@ bind_output (struct wl_client *client,
|
||||
|
||||
monitor = wayland_output->monitor;
|
||||
if (!monitor)
|
||||
return;
|
||||
{
|
||||
wl_resource_set_implementation (resource,
|
||||
&meta_wl_output_interface,
|
||||
NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
wayland_output->resources = g_list_prepend (wayland_output->resources,
|
||||
resource);
|
||||
|
Loading…
Reference in New Issue
Block a user