From b7ec3b163f6259c60a178087a4ff1b4df6538455 Mon Sep 17 00:00:00 2001 From: James Westman Date: Sun, 21 Apr 2019 21:14:15 -0500 Subject: [PATCH] quartz: Add missing g_object_ref A g_object_ref() call was missing, sometimes causing crashes during drag-and-drop operations. The matching g_object_unref() is at gdk/gdkdnd.c:261. The logic in this function is still wrong--it finds the wrong GdkWindow under some circumstances--but this commit fixes the crash. Part of #1840. --- gdk/quartz/GdkQuartzNSWindow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gdk/quartz/GdkQuartzNSWindow.c b/gdk/quartz/GdkQuartzNSWindow.c index 8d1ba4af2b..6de26b001b 100644 --- a/gdk/quartz/GdkQuartzNSWindow.c +++ b/gdk/quartz/GdkQuartzNSWindow.c @@ -788,7 +788,8 @@ update_context_from_dragging_info (id sender) wh = gdk_window_get_height (win); if (gx > wx && gy > wy && gx <= wx + ww && gy <= wy + wh) - event->dnd.context->dest_window = win; + event->dnd.context->dest_window = g_object_ref (win); + break; } }