summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Habacker <ralf.habacker@freenet.de>2011-07-01 14:28:19 (GMT)
committerRalf Habacker <ralf.habacker@freenet.de>2011-07-01 14:28:19 (GMT)
commite2f94ea14f6d712edf474ccf6c044a75fe744601 (patch)
treeb7db8e74b61bc4796db2ec39f159302f988c6f91
parent636a9a29f89326ca07d5bdbd41d874fa13910c17 (diff)
downloaddbus-e2f94ea14f6d712edf474ccf6c044a75fe744601.tar.gz
dbus-e2f94ea14f6d712edf474ccf6c044a75fe744601.tar.xz
win32 fix: Keep server autolaunch mutex settings according to client detection algorithmus.
-rw-r--r--dbus/dbus-sysdeps-win.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/dbus/dbus-sysdeps-win.c b/dbus/dbus-sysdeps-win.c
index 19f6fa0..7b03c3d 100644
--- a/dbus/dbus-sysdeps-win.c
+++ b/dbus/dbus-sysdeps-win.c
@@ -2639,6 +2639,10 @@ _dbus_daemon_is_session_bus_address_published (const char *scope)
// see http://msdn.microsoft.com/en-us/library/ms684315%28VS.85%29.aspx
hDBusDaemonMutex = CreateMutexA( NULL, FALSE, _dbus_string_get_const_data(&mutex_name) );
+ /* The client uses mutex ownership to detect a running server, so the server should do so too.
+ Fortunally the client deletes the mutex in the lock protected area, so checking presence
+ will work too. */
+
_dbus_global_unlock( lock );
_dbus_string_free( &mutex_name );
@@ -2684,6 +2688,14 @@ _dbus_daemon_publish_session_bus_address (const char* address, const char *scope
}
_dbus_string_free( &mutex_name );
+ // acquire the mutex
+ if (WaitForSingleObject( hDBusDaemonMutex, 10 ) != WAIT_OBJECT_0)
+ {
+ _dbus_global_unlock( lock );
+ CloseHandle( hDBusDaemonMutex );
+ return FALSE;
+ }
+
if (!_dbus_get_shm_name(&shm_name,scope))
{
_dbus_string_free( &shm_name );