diff options
author | Olivier Fourdan <ofourdan@redhat.com> | 2020-12-21 13:25:28 +0100 |
---|---|---|
committer | Olivier Fourdan <ofourdan@redhat.com> | 2020-12-22 14:45:00 +0100 |
commit | 904d7fa79899066865c6c9bf1a73762b6158ada8 (patch) | |
tree | e035ee4746d6726e800253fcb9a49fe7bee0ae04 /src/backends/native/meta-seat-impl.c | |
parent | 888e09a646873e4dbb28163544a7357c165b0c81 (diff) | |
download | mutter-904d7fa79899066865c6c9bf1a73762b6158ada8.tar.gz |
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 <carlosg@gnome.org>
Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/1587
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1652>
Diffstat (limited to 'src/backends/native/meta-seat-impl.c')
-rw-r--r-- | src/backends/native/meta-seat-impl.c | 3 |
1 files changed, 2 insertions, 1 deletions
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); |