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 692983 - GMainContext will dispatch non-ready sources if they used to be ready
GMainContext will dispatch non-ready sources if they used to be ready
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: mainloop
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2013-02-01 05:28 UTC by Allison Karlitskaya (desrt)
Modified: 2018-05-24 15:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
mainloop: test non-ready source being dispatched (3.25 KB, patch)
2013-02-01 05:28 UTC, Allison Karlitskaya (desrt)
none Details | Review
gmain: mark undispatched sources as unready again (1.17 KB, patch)
2013-02-15 17:34 UTC, Dan Winship
none Details | Review

Description Allison Karlitskaya (desrt) 2013-02-01 05:28:14 UTC
See the failing testcase and commit log message.
Comment 1 Allison Karlitskaya (desrt) 2013-02-01 05:28:17 UTC
Created attachment 234950 [details] [review]
mainloop: test non-ready source being dispatched

The way GMainContext is currently setup is that any source, once marked
'ready', must be dispatched, even if it is not dispatched during this
iteration and no longer ready on the next iteration (because something
cancelled it).

A source for a GCancellable that gets reset would be subject to this
problem, for example, but we put the testcase in glib/ so we use a toy
GSource to demonstrate.
Comment 2 Dan Winship 2013-02-01 20:42:00 UTC
So, we could just clear G_SOURCE_READY on everything either after dispatch or at the start of prepare. The question is, is there any reasonable code that would break if we did this? I don't think there is.
Comment 3 Dan Winship 2013-02-15 17:34:12 UTC
Created attachment 236278 [details] [review]
gmain: mark undispatched sources as unready again

GMainContext was assuming that once a source became ready, that it
would remain ready until it got dispatched (even if that wasn't until
a later iteration), but this is not always true. (Eg, a GCancellable
source would no longer be ready if its cancellable was reset.) Change
it to clear the ready flag on all undispatched sources at the end of
the iteration, so they will be checked again on the next iteration.
Comment 4 Dan Winship 2013-02-15 17:34:50 UTC
(In reply to comment #2)
> So, we could just clear G_SOURCE_READY on everything either after dispatch or
> at the start of prepare. The question is, is there any reasonable code that
> would break if we did this? I don't think there is.

I guess we've got that fancy "make check"-running bot now...
Comment 5 GNOME Infrastructure Team 2018-05-24 15:01:11 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/666.