diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-02-07 09:39:59 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-02-07 09:41:34 -0500 |
commit | 67877e403f6661b572c3290b8c905eadc9f5b00c (patch) | |
tree | e337ef2dffd76b9d9f544faeb64f98b3c4aa02eb | |
parent | 5b45f267d65419869608693499a78e9fe288bde5 (diff) | |
download | gtk+-67877e403f6661b572c3290b8c905eadc9f5b00c.tar.gz |
win32: Fix some leakswin32-drop-formats-leak
My reading of the code is that gdk_drop_new() is not
consuming the content formats it is given, so the caller
must not pass a new reference.
Needs testing on Windows.
-rw-r--r-- | gdk/win32/gdkdrop-win32.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gdk/win32/gdkdrop-win32.c b/gdk/win32/gdkdrop-win32.c index 6b0ac016b3..bd41e82ef7 100644 --- a/gdk/win32/gdkdrop-win32.c +++ b/gdk/win32/gdkdrop-win32.c @@ -477,7 +477,7 @@ _gdk_win32_local_drop_target_dragenter (GdkDrag *drag, drop = gdk_drop_new (display, gdk_seat_get_pointer (gdk_display_get_default_seat (display)), drag, - gdk_content_formats_ref (gdk_drag_get_formats (drag)), + gdk_drag_get_formats (drag), dest_surface, GDK_DRAG_PROTO_LOCAL); drop_win32 = GDK_WIN32_DROP (drop); @@ -519,6 +519,7 @@ idroptarget_dragenter (LPDROPTARGET This, GdkDrag *drag; GdkDragAction source_actions; GdkDragAction dest_actions; + GdkContentFormats *formats; GDK_NOTE (DND, g_print ("idroptarget_dragenter %p @ %ld : %ld" " for dest window 0x%p" @@ -538,15 +539,17 @@ idroptarget_dragenter (LPDROPTARGET This, drag = _gdk_win32_find_drag_for_dest_window (GDK_SURFACE_HWND (ctx->surface)); display = gdk_surface_get_display (ctx->surface); + + formats = query_object_formats (pDataObj, NULL); drop = gdk_drop_new (display, gdk_seat_get_pointer (gdk_display_get_default_seat (display)), drag, - query_object_formats (pDataObj, NULL), + formats, ctx->surface, GDK_DRAG_PROTO_OLE2); drop_win32 = GDK_WIN32_DROP (drop); g_array_set_size (drop_win32->droptarget_w32format_contentformat_map, 0); - gdk_content_formats_unref (query_object_formats (pDataObj, drop_win32->droptarget_w32format_contentformat_map)); + gdk_content_formats_unref (formats); ctx->drop = drop; |