diff --git a/mutter-clipboard-manager-crash.patch b/mutter-clipboard-manager-crash.patch new file mode 100644 index 0000000..c11b5c8 --- /dev/null +++ b/mutter-clipboard-manager-crash.patch @@ -0,0 +1,254 @@ +From 46b3811e22b3b898342141b1575c888285e51caf Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho +Date: Wed, 20 Nov 2019 00:27:54 +0100 +Subject: [PATCH 1/4] wayland: Drop unused wl_signal structs + +Those were used to signal clipboard ownership around, but that got +replaced by MetaSelection and friends. These signals are no longer +listened on, so can be safely removed. + +https://gitlab.gnome.org/GNOME/mutter/issues/591 +--- + src/wayland/meta-wayland-data-device.c | 11 ----------- + src/wayland/meta-wayland-data-device.h | 4 ---- + 2 files changed, 15 deletions(-) + +diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c +index 2887da62d..3a9f276aa 100644 +--- a/src/wayland/meta-wayland-data-device.c ++++ b/src/wayland/meta-wayland-data-device.c +@@ -1327,7 +1327,6 @@ selection_data_source_destroyed (gpointer data, GObject *object_was_here) + wl_data_device_send_selection (data_device_resource, NULL); + } + +- wl_signal_emit (&data_device->selection_ownership_signal, NULL); + unset_selection_source (data_device, META_SELECTION_CLIPBOARD); + } + +@@ -1599,8 +1598,6 @@ meta_wayland_data_device_set_dnd_source (MetaWaylandDataDevice *data_device, + if (source) + g_object_add_weak_pointer (G_OBJECT (data_device->dnd_data_source), + (gpointer *)&data_device->dnd_data_source); +- +- wl_signal_emit (&data_device->dnd_ownership_signal, source); + } + + void +@@ -1658,8 +1655,6 @@ meta_wayland_data_device_set_selection (MetaWaylandDataDevice *data_device, + wl_data_device_send_selection (data_device_resource, offer); + } + } +- +- wl_signal_emit (&data_device->selection_ownership_signal, source); + } + + static void +@@ -1725,7 +1720,6 @@ primary_source_destroyed (gpointer data, + gtk_primary_selection_device_send_selection (data_device_resource, NULL); + } + +- wl_signal_emit (&data_device->primary_ownership_signal, NULL); + unset_selection_source (data_device, META_SELECTION_PRIMARY); + } + +@@ -1785,8 +1779,6 @@ meta_wayland_data_device_set_primary (MetaWaylandDataDevice *data_device, + gtk_primary_selection_device_send_selection (data_device_resource, offer); + } + } +- +- wl_signal_emit (&data_device->primary_ownership_signal, source); + } + + static void +@@ -2009,9 +2001,6 @@ meta_wayland_data_device_init (MetaWaylandDataDevice *data_device) + { + wl_list_init (&data_device->resource_list); + wl_list_init (&data_device->primary_resource_list); +- wl_signal_init (&data_device->selection_ownership_signal); +- wl_signal_init (&data_device->primary_ownership_signal); +- wl_signal_init (&data_device->dnd_ownership_signal); + } + + static struct wl_resource * +diff --git a/src/wayland/meta-wayland-data-device.h b/src/wayland/meta-wayland-data-device.h +index efa5478bf..c61c241a5 100644 +--- a/src/wayland/meta-wayland-data-device.h ++++ b/src/wayland/meta-wayland-data-device.h +@@ -67,10 +67,6 @@ struct _MetaWaylandDataDevice + MetaWaylandDragGrab *current_grab; + struct wl_client *focus_client; + +- struct wl_signal selection_ownership_signal; +- struct wl_signal dnd_ownership_signal; +- struct wl_signal primary_ownership_signal; +- + guint selection_owner_signal_id; + + MetaSelectionSource *owners[META_N_SELECTION_TYPES]; +-- +2.22.0 + + +From e7b2f9603e90d87092c9e755c176f1244a8b3e36 Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho +Date: Wed, 20 Nov 2019 00:29:01 +0100 +Subject: [PATCH 2/4] wayland: Avoid redundant cancel() call + +This is unnecessary as we are unsetting the DnD selection owner, +and will result in the related data source being cancelled already. + +https://gitlab.gnome.org/GNOME/mutter/issues/591 +--- + src/wayland/meta-wayland-data-device.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c +index 3a9f276aa..5a669b5f5 100644 +--- a/src/wayland/meta-wayland-data-device.c ++++ b/src/wayland/meta-wayland-data-device.c +@@ -1068,7 +1068,6 @@ drag_grab_button (MetaWaylandPointerGrab *grab, + } + else + { +- meta_wayland_data_source_cancel (source); + meta_wayland_data_source_set_current_offer (source, NULL); + meta_wayland_data_device_set_dnd_source (&seat->data_device, NULL); + unset_selection_source (&seat->data_device, META_SELECTION_DND); +-- +2.22.0 + + +From 48639ac5da35697d885bd0736dea46e34a832ca2 Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho +Date: Wed, 20 Nov 2019 00:30:23 +0100 +Subject: [PATCH 3/4] wayland: Do not cancel data source on offer destruction + +This is wrong for both clipboard and DnD, as the selection source +will still be able to focus another surface, and churn another +wl_offer. + +We should just detach the data offer from the data source in this +case, and let the source live on. However, we should still check +that there is a source and an offer to finish DnD, do that when +handling the drop operation instead. + +https://gitlab.gnome.org/GNOME/mutter/issues/591 +--- + src/wayland/meta-wayland-data-device.c | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c +index 5a669b5f5..c83667b16 100644 +--- a/src/wayland/meta-wayland-data-device.c ++++ b/src/wayland/meta-wayland-data-device.c +@@ -582,12 +582,7 @@ destroy_data_offer (struct wl_resource *resource) + WL_DATA_OFFER_ACTION_SINCE_VERSION) + meta_wayland_data_source_notify_finish (offer->source); + else +- { +- if (seat->data_device.dnd_data_source == offer->source) +- unset_selection_source (&seat->data_device, META_SELECTION_DND); +- meta_wayland_data_source_cancel (offer->source); +- meta_wayland_data_source_set_current_offer (offer->source, NULL); +- } ++ meta_wayland_data_source_set_current_offer (offer->source, NULL); + } + + g_object_remove_weak_pointer (G_OBJECT (offer->source), +@@ -1045,6 +1040,7 @@ drag_grab_button (MetaWaylandPointerGrab *grab, + gboolean success; + + if (drag_grab->drag_focus && source && ++ meta_wayland_data_source_get_current_offer (source) && + meta_wayland_data_source_has_target (source) && + meta_wayland_data_source_get_current_action (source)) + { +-- +2.22.0 + + +From e5af790acb979ae9c8a0509052a42208c67639a6 Mon Sep 17 00:00:00 2001 +From: Carlos Garnacho +Date: Wed, 20 Nov 2019 00:32:21 +0100 +Subject: [PATCH 4/4] wayland: Move "ownership" of the DnD selection source to + the data device + +On wl_data_source destruction we used to indirectly unset the DnD selection +owner via the wl_resource destructor triggering the destruction of the +MetaWaylandDataSource, which would be caught through the weak ref set by +the MetaWaylandDragGrab. + +This works as long as the grab is held, however we have a window between +the button being released and the drop site replying with +wl_data_offer.finish that the MetaWaylandDataSource is alive, but its +destruction wouldn't result in the call chain above to unsetting the DnD +source. + +In other selection sources, we let the MetaWaylandDataDevice hold the +"ownership" of the MetaWaylandDataSource, and its weak ref functions unset +the respective MetaSelection owners. Do the same here, so the +MetaWaylandDataSource destruction is listened for all its lifetime. + +Closes: https://gitlab.gnome.org/GNOME/mutter/issues/591 +--- + src/wayland/meta-wayland-data-device.c | 26 ++++++++++++++++++++------ + 1 file changed, 20 insertions(+), 6 deletions(-) + +diff --git a/src/wayland/meta-wayland-data-device.c b/src/wayland/meta-wayland-data-device.c +index c83667b16..bee7fb8bc 100644 +--- a/src/wayland/meta-wayland-data-device.c ++++ b/src/wayland/meta-wayland-data-device.c +@@ -1138,8 +1138,6 @@ drag_grab_data_source_destroyed (gpointer data, GObject *where_the_object_was) + MetaWaylandDragGrab *drag_grab = data; + + drag_grab->drag_data_source = NULL; +- meta_wayland_data_device_set_dnd_source (&drag_grab->seat->data_device, NULL); +- unset_selection_source (&drag_grab->seat->data_device, META_SELECTION_DND); + data_device_end_drag_grab (drag_grab); + } + +@@ -1577,6 +1575,16 @@ meta_wayland_data_device_get_drag_dest_funcs (void) + return &meta_wayland_drag_dest_funcs; + } + ++static void ++dnd_data_source_destroyed (gpointer data, ++ GObject *object_was_here) ++{ ++ MetaWaylandDataDevice *data_device = data; ++ ++ data_device->dnd_data_source = NULL; ++ unset_selection_source (data_device, META_SELECTION_DND); ++} ++ + void + meta_wayland_data_device_set_dnd_source (MetaWaylandDataDevice *data_device, + MetaWaylandDataSource *source) +@@ -1585,14 +1593,20 @@ meta_wayland_data_device_set_dnd_source (MetaWaylandDataDevice *data_device, + return; + + if (data_device->dnd_data_source) +- g_object_remove_weak_pointer (G_OBJECT (data_device->dnd_data_source), +- (gpointer *)&data_device->dnd_data_source); ++ { ++ g_object_weak_unref (G_OBJECT (data_device->dnd_data_source), ++ dnd_data_source_destroyed, ++ data_device); ++ } + + data_device->dnd_data_source = source; + + if (source) +- g_object_add_weak_pointer (G_OBJECT (data_device->dnd_data_source), +- (gpointer *)&data_device->dnd_data_source); ++ { ++ g_object_weak_ref (G_OBJECT (source), ++ dnd_data_source_destroyed, ++ data_device); ++ } + } + + void +-- +2.22.0 + diff --git a/mutter.spec b/mutter.spec index e341fcc..9a3a9f7 100644 --- a/mutter.spec +++ b/mutter.spec @@ -8,7 +8,7 @@ Name: mutter Version: 3.34.1 -Release: 11%{?dist} +Release: 12%{?dist} Summary: Window and compositing manager based on Clutter License: GPLv2+ @@ -39,6 +39,9 @@ Patch4: mutter-gnome-3-34-2019-11-12.patch # Mitigate crash on tear down. (rhbz#1770089, rhbz#1770089) Patch5: 0001-compositor-Guard-against-untimely-calls.patch +# https://gitlab.gnome.org/GNOME/mutter/merge_requests/943 +Patch6: mutter-clipboard-manager-crash.patch + BuildRequires: chrpath BuildRequires: pango-devel BuildRequires: startup-notification-devel @@ -182,6 +185,9 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop %{_datadir}/mutter-%{mutter_api_version}/tests %changelog +* Mon Dec 02 2019 Michael Catanzaro - 3.34.1-12 +- Backport patch to fix clipboard manager crashes + * Tue Nov 12 2019 Jonas Ã…dahl - 3.34.1-11 - Backport two memory leak fixes