[mutter/gnome-3-26] wayland-outputs: Delay wl_output destruction
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gnome-3-26] wayland-outputs: Delay wl_output destruction
- Date: Fri, 15 Dec 2017 13:59:16 +0000 (UTC)
commit cde5454622d99320a66f2fd352df132a4bfdab4b
Author: Rui Matos <tiagomatos gmail com>
Date: Wed Dec 6 17:05:02 2017 +0100
wayland-outputs: Delay wl_output destruction
This tries to avoid wayland clients getting disconnected for binding
to a wl_output that we already destroyed which is a known protocol
race condition, see https://phabricator.freedesktop.org/T7722 .
https://bugzilla.gnome.org/show_bug.cgi?id=789070
src/wayland/meta-wayland-outputs.c | 23 ++++++++++++++++++++++-
1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/src/wayland/meta-wayland-outputs.c b/src/wayland/meta-wayland-outputs.c
index 51f62f9..4dfdb18 100644
--- a/src/wayland/meta-wayland-outputs.c
+++ b/src/wayland/meta-wayland-outputs.c
@@ -244,6 +244,9 @@ bind_output (struct wl_client *client,
wl_resource_set_user_data (resource, wayland_output);
wl_resource_set_destructor (resource, output_resource_destroy);
+ if (!logical_monitor)
+ return;
+
monitor = pick_main_monitor (logical_monitor);
meta_verbose ("Binding monitor %p/%s (%u, %u, %u, %u) x %f\n",
@@ -322,6 +325,22 @@ meta_wayland_output_new (MetaWaylandCompositor *compositor,
return wayland_output;
}
+static void
+nullify_logical_monitor (gpointer key,
+ gpointer value,
+ gpointer data)
+{
+ MetaWaylandOutput *wayland_output = value;
+ wayland_output->logical_monitor = NULL;
+}
+
+static gboolean
+delayed_destroy_outputs (gpointer data)
+{
+ g_hash_table_destroy (data);
+ return G_SOURCE_REMOVE;
+}
+
static GHashTable *
meta_wayland_compositor_update_outputs (MetaWaylandCompositor *compositor,
MetaMonitorManager *monitor_manager)
@@ -362,7 +381,9 @@ meta_wayland_compositor_update_outputs (MetaWaylandCompositor *compositor,
wayland_output);
}
- g_hash_table_destroy (compositor->outputs);
+ g_hash_table_foreach (compositor->outputs, nullify_logical_monitor, NULL);
+ g_timeout_add_seconds (10, delayed_destroy_outputs, compositor->outputs);
+
return new_table;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]