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 749496 - g_main_context_invoke_full race condition
g_main_context_invoke_full race condition
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: mainloop
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2015-05-17 13:47 UTC by smidjar2.reg
Modified: 2018-05-24 17:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
example showing the race condition (1.22 KB, text/x-csrc)
2015-05-17 13:47 UTC, smidjar2.reg
Details

Description smidjar2.reg 2015-05-17 13:47:21 UTC
Created attachment 303481 [details]
example showing the race condition

g_main_context_invoke_full contains a race condition. When the context is owned by current thread, but its ownership changes in invocation of the callback function, it will be invoked on the wrong thread.

Suggested solution 1: acquire the context before running the loop and release it after, similar to what is done if the context is thread-default.

Suggested solution 2: keep checking if the context is owned after each callback invocation and the callback returned TRUE. When the context ownership changes, fall through to create idle source.
Comment 1 GNOME Infrastructure Team 2018-05-24 17:50:29 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/1038.