GNOME Bugzilla – Bug 637691
Eating events breaks proxied DND
Last modified: 2011-01-05 09:33:10 UTC
While working on bug 601731 I noticed that for some reason the dnd operation (using the shell as proxy) only works once for every app. While debugging I found that the first source context that never gets freed which results into multiple gdk_window_cache_shape_filter running at the same time where the first one eats the events by returning GDK_FILTER_REMOVE, which results into the second context never seeing the events. Changing it to always return GDK_FILTER_CONTINUE fixed it, and also resulted into the first context being actually freed (no idea why though). The same seems to happen for the dnd from app -> gnome-panel -> other app case, but here it is caused by gdk_window_cache_filter (likewise making it always return GDK_FILTER_CONTINUE fixes it).
Created attachment 176795 [details] [review] GdkWindowCache: Always return GDK_FILTER_CONTINUE in event filters Eating events by returing GDK_FILTER_REMOVE seems to break DND in some cases. ---- FWIW here is the patch that fixes it, I still don't understand *why* it works though.
I think we need to find out some more here first. One thing to notice first is that we have a window cache per screen, each with its own shape filter, but the shape filter is run for events on all screens. To be more correct, the shape filter should only return GDK_FILTER_REMOVE if the shape event occurred on the correct screen. Now, I doubt that you have multiple protocol screens, thus this is probably not the source of the problem.
(In reply to comment #2) > I think we need to find out some more here first. Yeah. > One thing to notice first is that we have a window cache per screen, each with > its own shape filter, but the shape filter is run for events on all screens. Well actually it is per context, per screen so if we somehow end up with more than one source context we can have multiple filters for one screen. Which seems to happen here as the first context is never freed and thus the filter never removed. It makes sense that using GDK_FILTER_CONTINUE fixes it in that case but not that it fixes the "first context is never being freed issue" (which it does). > To > be more correct, the shape filter should only return GDK_FILTER_REMOVE if the > shape event occurred on the correct screen. > > Now, I doubt that you have multiple protocol screens, thus this is probably not > the source of the problem. Yeah this is a single (protocol and physical) screen case.
I have instrumented drag_context_init / finalize and so far haven't seen a source context being left behind. What I do see is that we tend to keep a dest context around, since current_drag_dest in the display keeps a reference. But that should not really matter, since dest contexts never have window caches, and thus don't have any filters installed. app -> gnome-panel -> other app Can you describe this case in more detail ? I haven't been able to reproduce it
Here a video (http://193.200.113.196/apache2-default/dndbug.ogv) reproducing it (first dnd action works, second does not), with debug output in the terminal: init: (0x2113df0) new_source (0x2113df0) init: (0x2113ed0) free (0x2113ed0) is_source: 0 init: (0x2244070) new_source (0x2244070) init: (0x2244150) free (0x2244150) is_source: 0 init: (0x2244230) free (0x2244230) is_source: 0 Notice that the first source (0x2113df0) does not have a free entry (and that is_source is always 0). I got the output by adding prints in gdk_drag_context_init(), gdk_drag_context_finalize() and gdk_drag_begin().
Sadly, I'm not seeing this here
(In reply to comment #6) > Sadly, I'm not seeing this here :/ .. any tips on how to track this down? I am running out of ideas ...
Created attachment 177525 [details] [review] GdkDndX11: Decouple the window caches from the source context Currently window caches are per context per screen rather than globally per screen. Due to the fact that they register window filters odd interactions can happen when multiple context are around. See: https://bugzilla.gnome.org/show_bug.cgi?id=144324 https://bugzilla.gnome.org/show_bug.cgi?id=637691 Fix that by just keeping a global window_caches list which is shared by all contexts.
Committed a slightly more involved patch that avoid dropping the cache too frequently when doing intra-process dnd.
(In reply to comment #9) > Committed a slightly more involved patch that avoid dropping the cache too > frequently when doing intra-process dnd. Thanks, is it possible to cherry-pick this into the 2.x branch? (We'd want dnd to work between gtk2 apps and the shell too).