mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
dnd: Guard drags with a reference when finishing
Usually the "dnd-finished" signal will be used to unref the GdkDrag. In those cases, we would lose the object, so that when we do the final drag_drop_done() afterwards, we wouldn't have a remaining reference. With the reference guard, this now works.
This commit is contained in:
parent
620ccdabb5
commit
f5dc71021f
@ -242,9 +242,11 @@ gdk_macos_drag_drop_performed (GdkDrag *drag,
|
||||
|
||||
g_assert (GDK_IS_MACOS_DRAG (self));
|
||||
|
||||
g_object_ref (self);
|
||||
drag_ungrab (self);
|
||||
g_signal_emit_by_name (drag, "dnd-finished");
|
||||
gdk_drag_drop_done (drag, TRUE);
|
||||
g_object_unref (self);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -290,8 +290,10 @@ data_source_dnd_finished (void *data,
|
||||
{
|
||||
GdkDrag *drag = data;
|
||||
|
||||
g_object_ref (drag);
|
||||
g_signal_emit_by_name (drag, "dnd-finished");
|
||||
gdk_drag_drop_done (drag, TRUE);
|
||||
g_object_unref (drag);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -884,8 +884,10 @@ gdk_x11_drag_handle_finished (GdkDisplay *display,
|
||||
if (drag_x11->version == 5)
|
||||
drag_x11->drop_failed = xevent->xclient.data.l[1] == 0;
|
||||
|
||||
g_object_ref (drag);
|
||||
g_signal_emit_by_name (drag, "dnd-finished");
|
||||
gdk_drag_drop_done (drag, !drag_x11->drop_failed);
|
||||
g_object_unref (drag);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user