After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 770940 - wayland/xwayland: Gracefully handle Xdnd start drag focus race
wayland/xwayland: Gracefully handle Xdnd start drag focus race
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: wayland
unspecified
Other All
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2016-09-06 11:06 UTC by Jonas Ådahl
Modified: 2016-09-15 02:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
wayland/xwayland: Gracefully handle Xdnd start drag focus race (2.03 KB, patch)
2016-09-06 11:06 UTC, Jonas Ådahl
committed Details | Review

Description Jonas Ådahl 2016-09-06 11:06:47 UTC
This probably fixes https://bugzilla.redhat.com/show_bug.cgi?id=1288875 .

The way I reproduced this was applying the following patch to gtk+:

diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c
index c9f34e2..e0b5e61 100644
--- a/gtk/gtkdnd.c
+++ b/gtk/gtkdnd.c
@@ -2507,6 +2507,7 @@ gtk_drag_source_check_selection (GtkDragSourceInfo *info,
 {
   GList *tmp_list;
 
+  usleep(1000000);
   tmp_list = info->selections;
   while (tmp_list)
     {

and then, by using GDK_BACKEND=x11 ./testdnd in gtk+/tests/ start the drag, and
quickly release outside of the window, before the above sleep had completed.
Without the attached patch this would crash mutter.

The focus surface is used as a "drag origin" in the DND feedback actor. Not
sure what exactly it's fore (Carlos?), but I found no way to get the correct
drag origin for Xdnd by just looking at the received event. Maybe there is a
better way than just lookig at what happens to be focused. After this patch,
the Xwayland dnd integration accepts any arbitrary Xwayland surface to be
focused for using as a drag origin.
Comment 1 Jonas Ådahl 2016-09-06 11:06:51 UTC
Created attachment 334892 [details] [review]
wayland/xwayland: Gracefully handle Xdnd start drag focus race

If a X11 client would initiate a Xdnd session after it had lost pointer
focus (for example when the Xdnd event starting the drag happens after
the implicit pointer grab is already broken due to the button being
released), just end the drag operation instead of dereferencing the
non-existing focus surface.

Also avoid using a native Wayland surface as a drag origin, as that can
never happen, but allow any arbitrary Xwayland client, since there is
no way to find out the actual drag origin.
Comment 2 Carlos Garnacho 2016-09-13 16:14:38 UTC
Comment on attachment 334892 [details] [review]
wayland/xwayland: Gracefully handle Xdnd start drag focus race

Indeed, it makes sense to double check things here.
Comment 3 Jonas Ådahl 2016-09-15 02:34:54 UTC
Attachment 334892 [details] pushed as b1d9543 - wayland/xwayland: Gracefully handle Xdnd start drag focus race