projects
/
platform
/
upstream
/
glib.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5527a2a
)
Fix race in g_cancellable_cancel()
author
Benjamin Otte
<otte@redhat.com>
Fri, 26 Mar 2010 19:37:09 +0000
(20:37 +0100)
committer
Ryan Lortie
<desrt@desrt.ca>
Mon, 29 Mar 2010 17:57:35 +0000
(12:57 -0500)
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.
gio/gcancellable.c
patch
|
blob
|
history
diff --git
a/gio/gcancellable.c
b/gio/gcancellable.c
index
2d600c9
..
32d01ae
100644
(file)
--- a/
gio/gcancellable.c
+++ b/
gio/gcancellable.c
@@
-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;