diff options
author | Ralf Habacker <ralf.habacker@freenet.de> | 2016-05-13 00:56:42 +0200 |
---|---|---|
committer | Ralf Habacker <ralf.habacker@freenet.de> | 2016-05-13 13:39:19 +0200 |
commit | a5c51278add34ea57e194c778efb478502578e8f (patch) | |
tree | b8ac23a6fcc593e4b1411b0255e98cea7c1ce1dd | |
parent | 5ef167c1399499cf12d5800855cbe80f5b2439b6 (diff) | |
download | dbus-a5c51278add34ea57e194c778efb478502578e8f.tar.gz |
Eliminates a race condition accessing DBusBabysitter instance at startup of babysitter() on Windows.
Ensure that the babysitter thread already owns its one reference to the
babysitter when it starts up, and eliminates the race condition.
This patch requires that DBusBabysitter refcounting is thread-safe
and is based on an analysis and proposal of Simon Mc Vittie.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=95191
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
-rw-r--r-- | dbus/dbus-spawn-win.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/dbus/dbus-spawn-win.c b/dbus/dbus-spawn-win.c index 804aa426..fa290638 100644 --- a/dbus/dbus-spawn-win.c +++ b/dbus/dbus-spawn-win.c @@ -586,8 +586,6 @@ babysitter (void *parameter) DBusBabysitter *sitter = (DBusBabysitter *) parameter; PING(); - _dbus_babysitter_ref (sitter); - if (sitter->child_setup) { PING(); @@ -728,7 +726,7 @@ _dbus_spawn_async_with_babysitter (DBusBabysitter **sitter_p, PING(); sitter_thread = (HANDLE) CreateThread (NULL, 0, babysitter, - sitter, 0, &sitter_thread_id); + _dbus_babysitter_ref (sitter), 0, &sitter_thread_id); if (sitter_thread == 0) { |