Commit 9e952bc7 authored by Matthias Clasen's avatar Matthias Clasen
Browse files

dragsource: Keep the source alive long enough

When a drop causes the event controller to be finalized
(directly or indirectly), we end up segfaulting while
trying to wrap up the drag operation. So, keep a reference
on the GtkDragSource from when the drag begins to when
it is done.

This fixes a crash in gnome-todo when dragging tasks.
parent ed97339e
Pipeline #279713 failed with stages
in 18 minutes and 43 seconds
......@@ -470,6 +470,7 @@ drag_end (GtkDragSource *source,
gdk_drag_drop_done (source->drag, success);
g_clear_object (&source->drag);
g_object_unref (source);
static void
......@@ -593,6 +594,9 @@ gtk_drag_source_drag_begin (GtkDragSource *source)
gtk_drag_source_ensure_icon (source, source->drag);
/* Keep the source alive until the drag is done */
g_object_ref (source);
g_signal_connect (source->drag, "dnd-finished",
G_CALLBACK (gtk_drag_source_dnd_finished_cb), source);
g_signal_connect (source->drag, "cancel",
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment