Compare commits

...

3 Commits

Author SHA1 Message Date
Claudio Saavedra
df1177e3ae gdk/win32: remove drag animation source on finalize
The drag animation source needs to be removed when the drag
object is finalized, otherwise it's possible that the source
stays in the main loop after even after the object is gone.

Fixes #6108
2023-09-21 18:26:09 +03:00
Claudio Saavedra
5613d57f76 gdk/macos: remove drag animation source on finalize
The drag animation source needs to be removed when the drag
object is finalized, otherwise it's possible that the source
stays in the main loop after even after the object is gone.

Fixes #6108
2023-09-21 18:25:44 +03:00
Claudio Saavedra
c25230f485 gdk/x11: remove drag animation source on finalize
The drag animation source needs to be removed when the drag
object is finalized, otherwise it's possible that the source
stays in the main loop after even after the object is gone.

Fixes #6108
2023-09-21 18:25:19 +03:00
5 changed files with 24 additions and 16 deletions

View File

@@ -53,6 +53,8 @@ struct _GdkMacosDrag
guint did_update : 1;
guint cancelled : 1;
guint anim_timeout_id;
};
struct _GdkMacosDragClass

View File

@@ -143,7 +143,6 @@ gdk_macos_drag_drop_done (GdkDrag *drag,
{
GdkMacosDrag *self = (GdkMacosDrag *)drag;
GdkMacosZoomback *zb;
guint id;
g_assert (GDK_IS_MACOS_DRAG (self));
@@ -162,11 +161,11 @@ gdk_macos_drag_drop_done (GdkDrag *drag,
zb->frame_clock = gdk_surface_get_frame_clock (GDK_SURFACE (self->drag_surface));
zb->start_time = gdk_frame_clock_get_frame_time (zb->frame_clock);
id = g_timeout_add_full (G_PRIORITY_DEFAULT, 17,
gdk_macos_zoomback_timeout,
zb,
(GDestroyNotify) gdk_macos_zoomback_destroy);
gdk_source_set_static_name_by_id (id, "[gtk] gdk_macos_zoomback_timeout");
self->anim_timeout_id = g_timeout_add_full (G_PRIORITY_DEFAULT, 17,
gdk_macos_zoomback_timeout,
zb,
(GDestroyNotify) gdk_macos_zoomback_destroy);
gdk_source_set_static_name_by_id (self->anim_timeout_id, "[gtk] gdk_macos_zoomback_timeout");
g_object_unref (drag);
}
@@ -282,6 +281,8 @@ gdk_macos_drag_finalize (GObject *object)
g_clear_object (&self->cursor);
g_clear_handle_id(&self->anim_timeout_id, g_source_remove);
G_OBJECT_CLASS (gdk_macos_drag_parent_class)->finalize (object);
if (drag_surface)

View File

@@ -753,6 +753,8 @@ gdk_win32_drag_finalize (GObject *object)
g_set_object (&drag_win32->grab_surface, NULL);
drag_surface = drag_win32->drag_surface;
g_clear_handle_id (&drag_win32->anim_timeout_id, g_source_remove);
G_OBJECT_CLASS (gdk_win32_drag_parent_class)->finalize (object);
if (drag_surface)
@@ -1867,7 +1869,6 @@ gdk_win32_drag_drop_done (GdkDrag *drag,
GdkDragAnim *anim;
GdkWin32Clipdrop *clipdrop;
gpointer ddd;
guint id;
GDK_NOTE (DND, g_print ("gdk_win32_drag_drop_done: 0x%p %s\n",
drag,
@@ -1905,10 +1906,10 @@ gdk_win32_drag_drop_done (GdkDrag *drag,
drag_win32->util_data.last_x, drag_win32->util_data.last_y,
drag_win32->start_x, drag_win32->start_y));
id = g_timeout_add_full (G_PRIORITY_DEFAULT, 17,
gdk_drag_anim_timeout, anim,
(GDestroyNotify) gdk_drag_anim_destroy);
gdk_source_set_static_name_by_id (id, "[gtk] gdk_drag_anim_timeout");
drag_win32->anim_timeout_id = g_timeout_add_full (G_PRIORITY_DEFAULT, 17,
gdk_drag_anim_timeout, anim,
(GDestroyNotify) gdk_drag_anim_destroy);
gdk_source_set_static_name_by_id (drag_win32->anim_timeout_id, "[gtk] gdk_drag_anim_timeout");
}
static gboolean

View File

@@ -72,6 +72,8 @@ struct _GdkWin32Drag
*/
GdkDragAction current_action;
guint anim_timeout_id;
GdkWin32DragUtilityData util_data;
guint scale; /* Temporarily caches the HiDPI scale */

View File

@@ -116,6 +116,7 @@ struct _GdkX11Drag
GdkSeat *grab_seat;
GdkDragAction actions;
GdkDragAction current_action;
guint anim_timeout_id;
int hot_x;
int hot_y;
@@ -214,6 +215,8 @@ gdk_x11_drag_finalize (GObject *object)
drag_surface = x11_drag->drag_surface;
ipc_surface = x11_drag->ipc_surface;
g_clear_handle_id (&x11_drag->anim_timeout_id, g_source_remove);
G_OBJECT_CLASS (gdk_x11_drag_parent_class)->finalize (object);
if (drag_surface)
@@ -1801,7 +1804,6 @@ gdk_x11_drag_drop_done (GdkDrag *drag,
{
GdkX11Drag *x11_drag = GDK_X11_DRAG (drag);
GdkDragAnim *anim;
guint id;
gdk_x11_drag_release_selection (drag);
@@ -1820,10 +1822,10 @@ gdk_x11_drag_drop_done (GdkDrag *drag,
anim->frame_clock = gdk_surface_get_frame_clock (x11_drag->drag_surface);
anim->start_time = gdk_frame_clock_get_frame_time (anim->frame_clock);
id = g_timeout_add_full (G_PRIORITY_DEFAULT, 17,
gdk_drag_anim_timeout, anim,
(GDestroyNotify) gdk_drag_anim_destroy);
gdk_source_set_static_name_by_id (id, "[gtk] gdk_drag_anim_timeout");
x11_drag->anim_timeout_id = g_timeout_add_full (G_PRIORITY_DEFAULT, 17,
gdk_drag_anim_timeout, anim,
(GDestroyNotify) gdk_drag_anim_destroy);
gdk_source_set_static_name_by_id (x11_drag->anim_timeout_id, "[gtk] gdk_drag_anim_timeout");
g_object_unref (drag);
}