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 708998 - Infinite loop in gdkevents.c _gdk_event_queue_find_first on OS X
Infinite loop in gdkevents.c _gdk_event_queue_find_first on OS X
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: X11
3.8.x
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2013-09-28 16:08 UTC by hamish.k.mackenzie
Modified: 2014-01-25 02:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Avoids infinite loop (1.23 KB, patch)
2013-09-28 16:17 UTC, hamish.k.mackenzie
needs-work Details | Review
Updated patch (810 bytes, patch)
2013-09-29 14:34 UTC, hamish.k.mackenzie
none Details | Review
Updated patch (1019 bytes, patch)
2013-09-29 17:51 UTC, hamish.k.mackenzie
none Details | Review
Fix formatting as well (1020 bytes, patch)
2013-09-29 17:57 UTC, hamish.k.mackenzie
committed Details | Review

Description hamish.k.mackenzie 2013-09-28 16:08:58 UTC
I was having trouble with keyboard accelerators on OS X. I am using Gtk 3.8, but I think the bug is still in Gtk 3.10 and in git.

When there is an event with the GDK_EVENT_PENDING flag set, the function goes into an infinite loop.

It looks like an oversight in this change...
https://git.gnome.org/browse/gtk+/commit/gdk/gdkevents.c?id=a69285da08a2a61d5fd817ee8ccb88a6b6deaef6

I think the fix might be to change

if (event->flags & GDK_EVENT_PENDING)
  continue;
...
tmp_list = g_list_next (tmp_list);

to

if (!(event->flags & GDK_EVENT_PENDING))
  {
   ...
  }
tmp_list = g_list_next (tmp_list);

It seems to work.
Comment 1 hamish.k.mackenzie 2013-09-28 16:17:48 UTC
Created attachment 255988 [details] [review]
Avoids infinite loop
Comment 2 John Ralls 2013-09-28 17:09:19 UTC
Comment on attachment 255988 [details] [review]
Avoids infinite loop

I think using for instead of while and leaving the loop body as-is (except for the g_list_next, of course) would be cleaner.

The bug was introduced in a69285da.
Comment 3 hamish.k.mackenzie 2013-09-29 14:34:52 UTC
Created attachment 256023 [details] [review]
Updated patch
Comment 4 John Ralls 2013-09-29 17:24:59 UTC
Comment on attachment 256023 [details] [review]
Updated patch

Are you allergic to for loops on lists?
Comment 5 hamish.k.mackenzie 2013-09-29 17:51:04 UTC
Created attachment 256033 [details] [review]
Updated patch

Sorry did not read your comment carefully enough, completely missed the point.
Comment 6 hamish.k.mackenzie 2013-09-29 17:57:00 UTC
Created attachment 256034 [details] [review]
Fix formatting as well
Comment 7 John Ralls 2013-09-29 18:19:12 UTC
Comment on attachment 256034 [details] [review]
Fix formatting as well

OK, that looks good. We just need Matthias to OK it.
Comment 8 John Ralls 2013-10-11 18:07:16 UTC
Comment on attachment 256034 [details] [review]
Fix formatting as well

Waited long enough. Committed and backported to 3.10.