summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Fourdan <ofourdan@redhat.com>2019-04-15 14:55:45 +0200
committerOlivier Fourdan <ofourdan@redhat.com>2019-04-15 15:41:47 +0200
commit2c1a951b6e81ea583e9a83ce29343d7ffd5739d9 (patch)
treed38682388af355f93411bb1c383c327778356c95
parent6ec330ccfa55509ffef8deb0eeb47ff8bf392605 (diff)
downloadmutter-2c1a951b6e81ea583e9a83ce29343d7ffd5739d9.tar.gz
wayland/output: Set user data of xdg_output resource
mutter would randomly crash in `send_xdg_output_events()` when changing the fractional scaling: wl_resource_post_event () zxdg_output_v1_send_logical_size () send_xdg_output_events () wayland_output_update_for_output () meta_wayland_compositor_update_outputs () on_monitors_changed () g_closure_invoke () signal_emit_unlocked_R () g_signal_emit_valist () _signal_emit () meta_monitor_manager_notify_monitors_changed () meta_monitor_manager_rebuild () This is because the xdg-output resource got freed but wasn't removed from the list of resources. Fix this by setting the user data of the xdg-output resource to the corresponding `MetaWaylandOutput` so that the xdg-output resource destructor can remove it from the list of resources. https://gitlab.gnome.org/GNOME/mutter/merge_requests/538
-rw-r--r--src/wayland/meta-wayland-outputs.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/wayland/meta-wayland-outputs.c b/src/wayland/meta-wayland-outputs.c
index 7695d86af..099e87ab9 100644
--- a/src/wayland/meta-wayland-outputs.c
+++ b/src/wayland/meta-wayland-outputs.c
@@ -624,14 +624,14 @@ meta_xdg_output_manager_get_xdg_output (struct wl_client *client,
wl_resource_get_version (resource),
id);
- wl_resource_set_implementation (xdg_output_resource,
- &meta_xdg_output_interface,
- NULL, meta_xdg_output_destructor);
-
wayland_output = wl_resource_get_user_data (output);
if (!wayland_output)
return;
+ wl_resource_set_implementation (xdg_output_resource,
+ &meta_xdg_output_interface,
+ wayland_output, meta_xdg_output_destructor);
+
wayland_output->xdg_output_resources =
g_list_prepend (wayland_output->xdg_output_resources, xdg_output_resource);