diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2015-06-29 16:32:01 +0200 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2015-06-29 18:39:05 +0200 |
commit | 50178ce0147388ceffd7cafedfd85befcdfc4137 (patch) | |
tree | de7fe01488dd9397f936a4301caf8724fd44a0ec | |
parent | 109572286c138c11850cefb823e839c6f29d37b8 (diff) | |
download | gtk+-50178ce0147388ceffd7cafedfd85befcdfc4137.tar.gz |
wayland: Prepare against NULL selection owners on data_source requests
Currently, due to the lack of progress information in the Wayland DnD
protocol, we assume a DnD operation is finished after the first
data_source.send is finished (It's either that or leaving stuck grabs).
This however breaks previous assumptions that dest widgets can request
the data multiple times, even in response to GtkWidget::drag-motion.
This leaves us with a NULL owner for the DnD atom when we aren't
finished receiving wl_data_source events yet, causing a crash.
This commit fixes the crash, the behavior left is still far from
desirable though...
-rw-r--r-- | gdk/wayland/gdkselection-wayland.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gdk/wayland/gdkselection-wayland.c b/gdk/wayland/gdkselection-wayland.c index 455b0e6637..640fa4e112 100644 --- a/gdk/wayland/gdkselection-wayland.c +++ b/gdk/wayland/gdkselection-wayland.c @@ -705,7 +705,7 @@ data_source_target (void *data, { GdkWaylandSelection *wayland_selection = data; GdkDragContext *context = NULL; - GdkWindow *window; + GdkWindow *window = NULL; g_debug (G_STRLOC ": %s source = %p, mime_type = %s", G_STRFUNC, source, mime_type); @@ -732,7 +732,8 @@ data_source_target (void *data, } else if (source == wayland_selection->clipboard_source) window = wayland_selection->clipboard_owner; - else + + if (!window) return; gdk_wayland_selection_request_target (wayland_selection, window, @@ -771,6 +772,9 @@ data_source_send (void *data, return; } + if (!window) + return; + if (!gdk_wayland_selection_request_target (wayland_selection, window, gdk_atom_intern (mime_type, FALSE), fd)) |