mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-28 10:07:13 +02:00
Fix a locking problem in g_main_context_iterate()
We failed to ensure that the context is locked on every exit of the function. This fixes bug 583324.
This commit is contained in:
@@ -2390,13 +2390,13 @@ g_main_context_iterate (GMainContext *context,
|
|||||||
{
|
{
|
||||||
gboolean got_ownership;
|
gboolean got_ownership;
|
||||||
|
|
||||||
|
LOCK_CONTEXT (context);
|
||||||
|
|
||||||
g_return_val_if_fail (g_thread_supported (), FALSE);
|
g_return_val_if_fail (g_thread_supported (), FALSE);
|
||||||
|
|
||||||
if (!block)
|
if (!block)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
LOCK_CONTEXT (context);
|
|
||||||
|
|
||||||
if (!context->cond)
|
if (!context->cond)
|
||||||
context->cond = g_cond_new ();
|
context->cond = g_cond_new ();
|
||||||
|
|
||||||
@@ -2405,11 +2405,8 @@ g_main_context_iterate (GMainContext *context,
|
|||||||
g_static_mutex_get_mutex (&context->mutex));
|
g_static_mutex_get_mutex (&context->mutex));
|
||||||
|
|
||||||
if (!got_ownership)
|
if (!got_ownership)
|
||||||
{
|
|
||||||
UNLOCK_CONTEXT (context);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
LOCK_CONTEXT (context);
|
LOCK_CONTEXT (context);
|
||||||
#endif /* G_THREADS_ENABLED */
|
#endif /* G_THREADS_ENABLED */
|
||||||
|
Reference in New Issue
Block a user