diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-02-07 14:52:24 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2021-02-07 14:52:24 +0000 |
commit | 0cd2d01f3fc872bcdc98851c7aff51f489d42d0d (patch) | |
tree | bae4fda06c6a42ae6089c7a3d7427ccfd9bb103d | |
parent | 6396bf6d89e6659d797ccab68a4b159edd4af93d (diff) | |
parent | 0bce63e3ab47925328ef11f0093dd4fad3209240 (diff) | |
download | gtk+-0cd2d01f3fc872bcdc98851c7aff51f489d42d0d.tar.gz |
Merge branch 'fix-x11-drop' into 'master'
x11: More dnd fixes
Closes #3654
See merge request GNOME/gtk!3166
-rw-r--r-- | gdk/x11/gdkdrag-x11.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/gdk/x11/gdkdrag-x11.c b/gdk/x11/gdkdrag-x11.c index 05e1c58377..d8c9ac28b8 100644 --- a/gdk/x11/gdkdrag-x11.c +++ b/gdk/x11/gdkdrag-x11.c @@ -296,15 +296,20 @@ gdk_x11_drag_find (GdkDisplay *display, static void precache_target_list (GdkDrag *drag) { - GdkContentFormats *formats = gdk_drag_get_formats (drag); + GdkContentFormats *formats; const char * const *atoms; gsize n_atoms; + formats = gdk_content_formats_ref (gdk_drag_get_formats (drag)); + formats = gdk_content_formats_union_serialize_mime_types (formats); + atoms = gdk_content_formats_get_mime_types (formats, &n_atoms); _gdk_x11_precache_atoms (gdk_drag_get_display (drag), (const char **) atoms, n_atoms); + + gdk_content_formats_unref (formats); } /* Utility functions */ @@ -917,8 +922,12 @@ xdnd_set_targets (GdkX11Drag *drag_x11) const char * const *atoms; gsize i, n_atoms; GdkDisplay *display = gdk_drag_get_display (drag); + GdkContentFormats *formats; - atoms = gdk_content_formats_get_mime_types (gdk_drag_get_formats (drag), &n_atoms); + formats = gdk_content_formats_ref (gdk_drag_get_formats (drag)); + formats = gdk_content_formats_union_serialize_mime_types (formats); + + atoms = gdk_content_formats_get_mime_types (formats, &n_atoms); atomlist = g_new (Atom, n_atoms); for (i = 0; i < n_atoms; i++) atomlist[i] = gdk_x11_get_xatom_by_name_for_display (display, atoms[i]); @@ -932,6 +941,8 @@ xdnd_set_targets (GdkX11Drag *drag_x11) g_free (atomlist); drag_x11->xdnd_targets_set = 1; + + gdk_content_formats_unref (formats); } static void |