GNOME Bugzilla – Bug 81543
metacity crash when drag a String from qt apps.
Last modified: 2011-02-04 16:09:59 UTC
metacity crash when drag a String from qt apps to out of window. (I was tested with kwrite(kde3), and aviplay(qt2)) dragging other object (directory, file) are fine.
The problem here is that in xdnd_enter_filter(), event->any.window is used; event->any.window is filled in by gdk_event_translate(). However, it can be filled in as NULL. In this case, it's NULL because the window being entered is the client window that's the drag destination, which is not known to Metacity's instance of GDK so gdk_window_lookup() returns NULL. A simple test case is to open kwrite, open gtk-demo, type some stuff in kwrite, select it, dnd selection to the gtk-demo, as soon as you get an enter event on gtk-demo metacity will crash. Xnest recommended. ;-)
Is changing the code to GdkDisplay *display = gdk_x11_lookup_xdisplay (xevent->xany.display); GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display); instead of having GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (GDK_DRAWABLE_DISPLAY (event->any.window)); an OK fix?
I'm testing with the regular branch, not the multihead branch. Both probably need fixing in different ways.
I also had to add a NULL check in a call to gdk_window_ref. I can't drag from a qt app to a gtk app and have it copy the text though
Ugh, Qt must be calling XSendEvent() with a non-zero mask, and then Metacity must be listening to whatever that mask is on the toplevel window. (I The GDK code just needs to return if event->any.window is NULL or it's a foreign window. Clearly, metacity has no business interpreting DND events destined for GTK+. (I can't find any mention of the expected event_mask in the Xdnd spec, so can't prove that the Qt behavior is a bug in Qt, though I'd consider it so.)
Looks like Xdnd must be amended to specify that client messages must be send with an empty event mask in order to keep them from propagating up to unsuspecting embedders like the wm. Looking into this, I found: /************************************************************* * xdnd_send_xevent: * Like gdk_send_event, but if the target is the root * window, sets an event mask of ButtonPressMask, otherwise * an event mask of 0. * arguments: * * results: *************************************************************/ Is this a leftover form pre-Xdnd-V4 days ? With XdndProxy, it should never be necessary to send client messages to the root window, should it ? I wonder who receives events sent to the root window with an empty event mask, though.
Yes, I believe this is a leftover from earlier versions of the spec, or possibly a kfm compatibility hack. (Don't really remember at this point.) Nobody receives events sent to the root window with an event_mask of 0.
Will you contact John Lindal about the event mask clarification in Xdnd ?
Fixed: Thu Jun 13 15:02:49 2002 Owen Taylor <otaylor@redhat.com> * gdk/x11/gdkdnd-x11.c: Ignore all client events that were sent to a window that we don't know about or to a foreign window. (#81543, Young-Ho, Cha) Sent a quick mail to John Lindal.