gmain: Close race condition in _g_main_wake_up_all_contexts()
authorColin Walters <walters@verbum.org>
Tue, 14 Jun 2011 22:46:06 +0000 (18:46 -0400)
committerColin Walters <walters@verbum.org>
Tue, 14 Jun 2011 23:23:36 +0000 (19:23 -0400)
commitc9f883f133bc83942484cb8a1349b58ada46b4bc
tree54a587bd6e43b3b611aecea7a62941220828eae5
parent211d7adf6e452c30dc0b76225e7bdcddee7c5f8f
gmain: Close race condition in _g_main_wake_up_all_contexts()

Running gthread/tests/spawn-multithreaded in a loop, I very easily hit:

GLib-CRITICAL **: g_main_context_wakeup: assertion `g_atomic_int_get (&context->ref_count) > 0' failed

Testing the refcount still left a window where we would fall into the
assertion.  Fix this by just locking the context.
glib/gmain.c