mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-26 14:06:15 +01:00
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.
This commit is contained in:
parent
5527a2ac2c
commit
e7763678b5
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user