Commit e7763678 authored by Benjamin Otte's avatar Benjamin Otte Committed by Allison Karlitskaya

Fix race in g_cancellable_cancel()

We need to check priv->cancelled after taking the lock. Previously we
only checked it just before taking the lock, which left a small chance
for a race.
parent 5527a2ac
......@@ -622,6 +622,11 @@ g_cancellable_cancel (GCancellable *cancellable)
priv = cancellable->priv;
G_LOCK(cancellable);
if (priv->cancelled)
{
G_UNLOCK (cancellable);
return;
}
priv->cancelled = TRUE;
priv->cancelled_running = TRUE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment