summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-02-22 18:32:37 -0500
committerMatthias Clasen <mclasen@redhat.com>2020-02-22 19:02:13 -0500
commitf93d0f8fb5e6660126e5b4c35b2b9d8d5f189816 (patch)
treea218955eb5358df4e848283bfe9f7ab4cbcc36e9
parent833b56494692aa683144259852dd960691f6f033 (diff)
downloadgtk+-f93d0f8fb5e6660126e5b4c35b2b9d8d5f189816.tar.gz
x11: Keep a ref on GdkDrag objects
It is expected that backends keep a ref on the GdkDrag objects that they create as long as the drag is ongoing.
-rw-r--r--gdk/x11/gdkdrag-x11.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gdk/x11/gdkdrag-x11.c b/gdk/x11/gdkdrag-x11.c
index 48ad2b6862..c2bd36682a 100644
--- a/gdk/x11/gdkdrag-x11.c
+++ b/gdk/x11/gdkdrag-x11.c
@@ -900,16 +900,12 @@ gdk_x11_drag_handle_finished (GdkDisplay *display,
if (drag)
{
- g_object_ref (drag);
-
drag_x11 = GDK_X11_DRAG (drag);
if (drag_x11->version == 5)
drag_x11->drop_failed = xevent->xclient.data.l[1] == 0;
g_signal_emit_by_name (drag, "dnd-finished");
gdk_drag_drop_done (drag, !drag_x11->drop_failed);
-
- g_object_unref (drag);
}
}
@@ -1896,6 +1892,7 @@ gdk_x11_drag_drop_done (GdkDrag *drag,
if (success)
{
gdk_surface_hide (x11_drag->drag_surface);
+ g_object_unref (drag);
return;
}
@@ -1928,6 +1925,7 @@ gdk_x11_drag_drop_done (GdkDrag *drag,
gdk_drag_anim_timeout, anim,
(GDestroyNotify) gdk_drag_anim_destroy);
g_source_set_name_by_id (id, "[gtk] gdk_drag_anim_timeout");
+ g_object_unref (drag);
}
static gboolean
@@ -2097,7 +2095,7 @@ _gdk_x11_surface_drag_begin (GdkSurface *surface,
g_object_unref (drag);
return NULL;
}
-
+
move_drag_surface (drag, x_root, y_root);
x11_drag->timestamp = gdk_display_get_last_seen_time (display);
@@ -2113,7 +2111,10 @@ _gdk_x11_surface_drag_begin (GdkSurface *surface,
return NULL;
}
+
g_signal_connect_object (display, "xevent", G_CALLBACK (gdk_x11_drag_xevent), drag, 0);
+ /* backend holds a ref until gdk_drag_drop_done is called */
+ g_object_ref (drag);
return drag;
}