summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorArjan Molenaar <gaphor@gmail.com>2022-12-04 00:05:39 +0100
committerArjan Molenaar <gaphor@gmail.com>2022-12-13 15:19:04 +0100
commitd0c44130337197eba5306cf976ae1ee8559797e9 (patch)
tree2945f294aeada9a49f73c77edfe2bf488ce9cf39 /gdk
parent410fa9871f0111a99177e901b7e7e9af8d01a96e (diff)
downloadgtk+-d0c44130337197eba5306cf976ae1ee8559797e9.tar.gz
macos: Explicitly ungrab seat when drag is done or finalized
This is an extra safeguard that avoids grabbing resources longer than nessecary. It also ensures the resource is removed from the drag, so it is not freed again.
Diffstat (limited to 'gdk')
-rw-r--r--gdk/macos/gdkmacosdrag.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/gdk/macos/gdkmacosdrag.c b/gdk/macos/gdkmacosdrag.c
index b7d9726798..34e8be9874 100644
--- a/gdk/macos/gdkmacosdrag.c
+++ b/gdk/macos/gdkmacosdrag.c
@@ -218,6 +218,12 @@ drag_ungrab (GdkMacosDrag *self)
g_assert (GDK_IS_MACOS_DRAG (self));
+ if (self->drag_seat)
+ {
+ gdk_seat_ungrab (self->drag_seat);
+ g_clear_object(&self->drag_seat);
+ }
+
display = gdk_drag_get_display (GDK_DRAG (self));
_gdk_macos_display_break_all_grabs (GDK_MACOS_DISPLAY (display), GDK_CURRENT_TIME);
}
@@ -536,7 +542,11 @@ gdk_macos_drag_finalize (GObject *object)
GdkMacosDragSurface *drag_surface = g_steal_pointer (&self->drag_surface);
g_clear_object (&self->cursor);
- g_clear_object (&self->drag_seat);
+ if (self->drag_seat)
+ {
+ gdk_seat_ungrab (self->drag_seat);
+ g_clear_object (&self->drag_seat);
+ }
G_OBJECT_CLASS (gdk_macos_drag_parent_class)->finalize (object);