GNOME Bugzilla – Bug 705176
Reordering columns in GtkTreeView freezes mutter
Last modified: 2013-11-12 04:18:08 UTC
Start gnome-system-monitor and try to drag a column around. Mutter freezes and the only way out is to switch to another tty and kill gnome-system-monitor from there. (same behavior with gnome-shell or standalone mutter). I could see this with other apps, but can't find any right now (Nautilus is working, for istance). On the other hand, under metacity and other WMs (Unity, xfwm) the reordering works.
You can see (by waiting for the time to change, or by running some window like glxgears) that Mutter isn't actually frozen - instead what the situation is is: GTK+ has a pointer and keyboard grab GTK+ is not processing events This might be related to frame synchronization - that could be a reason that it *only* occurs with Mutter and not any other window manager.
(In reply to comment #1) > > GTK+ is not processing events > The culprit seems to be a while(gtk_events_pending()) { gtk_main_iteration(); } loop in gtktreeview.c, which consumes all the events. Removing it seems to "fix" the issue. I don't know why the event queue becomes empty only with frame synchronization. And honestly I have no idea if the patch is the right fix or just an hackish workaround, after all those kind of loops, while looking obsolete, shouldn't block GTK+
Created attachment 250601 [details] [review] treeview: fix dragging of columns in Mutter
Just to make it clear, this is already visible in tests/testtreeview by making a few columns reorderable.
The 'while(gtk_events_pending()) { gtk_main_iteration(); }' in that place makes no sense to me and can be removed, but I need to track down why that breaks frame synchronization. I made a start at it yesterday, and know some of the problems, but it will take some more investigation to come up with a final patch.
Confirming, as I have also seen this.
Created attachment 258913 [details] Simple sample app freezing mutter The attached code is a simple gtk app with a treeview with two reorderable columns, to illustrate the freezing mutter/gnome-shell problem. To reproduce, compile it, run it, and drag one of the column headers.
*** Bug 710024 has been marked as a duplicate of this bug. ***
Owen, did you ever get to the bottom of this ?
Created attachment 259596 [details] [review] Handle recursion from motion event handlers If a motion event handler (or other handler running from the flush-events phase of the frame clock) recursed the main loop then flushing wouldn't complete until after the recursed main loop returned, and various aspects of the state would get out of sync. To fix this, change flushing of the event queue to simply mark events as ready to flush, and let normal event delivery handle the rest.
Patch from comment #3 is also correct as far as I can see (with a better commit message), should be applied and might be a safer fix for the stable branch. (There could be other instances of this bug that it doesn't fix - it's a generic bug with recursing the main loop from a motion event handler.)
Attachment 259596 [details] pushed as f50a3af - Handle recursion from motion event handlers