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 705176 - Reordering columns in GtkTreeView freezes mutter
Reordering columns in GtkTreeView freezes mutter
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkTreeView
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtktreeview-bugs
gtktreeview-bugs
: 710024 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-07-30 21:50 UTC by Stefano Facchini
Modified: 2013-11-12 04:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
treeview: fix dragging of columns in Mutter (774 bytes, patch)
2013-08-01 09:44 UTC, Stefano Facchini
none Details | Review
Simple sample app freezing mutter (1.26 KB, text/x-csrc)
2013-11-04 11:04 UTC, Robert Roth
  Details
Handle recursion from motion event handlers (10.64 KB, patch)
2013-11-11 23:14 UTC, Owen Taylor
committed Details | Review

Description Stefano Facchini 2013-07-30 21:50:48 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.
Comment 1 Owen Taylor 2013-07-31 15:00:13 UTC
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.
Comment 2 Stefano Facchini 2013-08-01 09:44:07 UTC
(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+
Comment 3 Stefano Facchini 2013-08-01 09:44:47 UTC
Created attachment 250601 [details] [review]
treeview: fix dragging of columns in Mutter
Comment 4 Stefano Facchini 2013-08-03 13:49:43 UTC
Just to make it clear, this is already visible in tests/testtreeview by making a few columns reorderable.
Comment 5 Owen Taylor 2013-08-03 14:38:24 UTC
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.
Comment 6 Robert Roth 2013-10-25 07:55:04 UTC
Confirming, as I have also seen this.
Comment 7 Robert Roth 2013-11-04 11:04:18 UTC
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.
Comment 8 Robert Roth 2013-11-06 07:01:47 UTC
*** Bug 710024 has been marked as a duplicate of this bug. ***
Comment 9 Matthias Clasen 2013-11-09 19:32:55 UTC
Owen, did you ever get to the bottom of this ?
Comment 10 Owen Taylor 2013-11-11 23:14:26 UTC
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.
Comment 11 Owen Taylor 2013-11-11 23:16:48 UTC
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.)
Comment 12 Matthias Clasen 2013-11-12 04:18:04 UTC
Attachment 259596 [details] pushed as f50a3af - Handle recursion from motion event handlers