Skip to content

Commit 13d790c

Browse files
committed
ctkdnd: Fix crashes in cafe-panel
It happens moving windows in window list applet, sometimes after around 5 minutes later it crashes. based in gtk commits: https://gitlab.gnome.org/GNOME/gtk/-/commit/2353a7a176fc3f34e81b928adfdc9dbb3d40ce1a https://gitlab.gnome.org/GNOME/gtk/-/commit/34c12e4885dcb712272c441941234187cb131bc3 merged in MR: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6660 which fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/7128
1 parent ca2d3c7 commit 13d790c

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

ctk/ctkdnd.c

+16-4
Original file line numberDiff line numberDiff line change
@@ -2664,6 +2664,8 @@ ctk_drag_drop (CtkDragSourceInfo *info,
26642664
{
26652665
if (info->icon_window)
26662666
ctk_widget_hide (info->icon_window);
2667+
if (info->proxy_dest)
2668+
g_object_ref (info->proxy_dest->context);
26672669

26682670
cdk_drag_drop (info->context, time);
26692671
info->drop_timeout = cdk_threads_add_timeout (DROP_ABORT_TIME,
@@ -2757,7 +2759,7 @@ static void
27572759
ctk_drag_source_info_free (CtkDragSourceInfo *info)
27582760
{
27592761
ctk_drag_remove_icon (info);
2760-
ctk_widget_destroy (info->icon_window);
2762+
g_clear_pointer (&info->icon_window, ctk_widget_destroy);
27612763
g_free (info);
27622764
}
27632765

@@ -2812,7 +2814,11 @@ ctk_drag_source_info_destroy (CtkDragSourceInfo *info)
28122814
ctk_target_list_unref (info->target_list);
28132815

28142816
if (info->drop_timeout)
2815-
g_source_remove (info->drop_timeout);
2817+
{
2818+
g_source_remove (info->drop_timeout);
2819+
if (info->proxy_dest)
2820+
g_object_unref (info->proxy_dest->context);
2821+
}
28162822

28172823
if (info->update_idle)
28182824
g_source_remove (info->update_idle);
@@ -3258,14 +3264,20 @@ static gboolean
32583264
ctk_drag_abort_timeout (gpointer data)
32593265
{
32603266
CtkDragSourceInfo *info = data;
3267+
CdkDragContext *context = NULL;
32613268
guint32 time = CDK_CURRENT_TIME;
32623269

32633270
if (info->proxy_dest)
3264-
time = info->proxy_dest->proxy_drop_time;
3271+
{
3272+
time = info->proxy_dest->proxy_drop_time;
3273+
context = info->proxy_dest->context;
3274+
}
32653275

32663276
info->drop_timeout = 0;
32673277
ctk_drag_drop_finished (info, CTK_DRAG_RESULT_TIMEOUT_EXPIRED, time);
3268-
3278+
3279+
g_clear_object (&context);
3280+
32693281
return FALSE;
32703282
}
32713283

0 commit comments

Comments
 (0)