From 904d7fa79899066865c6c9bf1a73762b6158ada8 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Mon, 21 Dec 2020 13:25:28 +0100 Subject: [PATCH] backends/native: Protect against NULL pointer constraints To clear a pointer constraint, the Wayland backend passes a NULL constraint to the native input backend. The new async API however tries to reference/un-reference the given object to use it while running in a separate task, which leads to a warning from GLib trying to g_object_ref()/g_object_unref() a non GObject pointer. To avoid that issue, simply set the data only if the given constraints pointer is not NULL. Suggested-by: Carlos Garnacho Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1587 Part-of: --- src/backends/native/meta-seat-impl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backends/native/meta-seat-impl.c b/src/backends/native/meta-seat-impl.c index 904a9079f..a9c0053b8 100644 --- a/src/backends/native/meta-seat-impl.c +++ b/src/backends/native/meta-seat-impl.c @@ -3333,7 +3333,8 @@ meta_seat_impl_set_pointer_constraint (MetaSeatImpl *seat, g_return_if_fail (META_IS_SEAT_IMPL (seat)); task = g_task_new (seat, NULL, NULL, NULL); - g_task_set_task_data (task, g_object_ref (constraint_impl), g_object_unref); + if (constraint_impl) + g_task_set_task_data (task, g_object_ref (constraint_impl), g_object_unref); meta_seat_impl_run_input_task (seat, task, (GSourceFunc) set_pointer_constraint); g_object_unref (task);