]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
fixes bug where sometimes objects were not unregistered from dbus
authorRomain Pokrzywka <romain@kdab.com>
Thu, 14 Jan 2010 07:59:22 +0000 (08:59 +0100)
committerRalf Habacker <ralf.habacker@freenet.de>
Thu, 14 Jan 2010 08:10:25 +0000 (09:10 +0100)
although their app had exited. As it turns out it was a missing
implementation of the method _dbus_fd_set_close_on_exec() for windows.
It's been tested with msvc2005, msvc2008, and mingw, and solves
all the unregistering issues on many kde apps.

dbus/dbus-sysdeps-win.c

index c323820b83b7099004675269bee1f2eca1f1a0b5..300e9b120836dfc42b5a986c061c2651b528f41f 100644 (file)
@@ -275,31 +275,12 @@ _dbus_close_socket (int        fd,
 void
 _dbus_fd_set_close_on_exec (int handle)
 {
-#ifdef ENABLE_DBUSSOCKET
-  DBusSocket *s;
-  if (handle < 0)
-    return;
-
-  _dbus_lock_sockets();
-
-  _dbus_handle_to_socket_unlocked (handle, &s);
-  s->close_on_exec = TRUE;
-
-  _dbus_unlock_sockets();
-#else
-  /* TODO unic code.
-  int val;
-  
-  val = fcntl (fd, F_GETFD, 0);
-  
-  if (val < 0)
-    return;
-
-  val |= FD_CLOEXEC;
-  
-  fcntl (fd, F_SETFD, val);
-  */
-#endif
+  if ( !SetHandleInformation( (HANDLE) handle,
+                        HANDLE_FLAG_INHERIT | HANDLE_FLAG_PROTECT_FROM_CLOSE,
+                        0 /*disable both flags*/ ) )
+    {
+      _dbus_win_warn_win_error ("Disabling socket handle inheritance failed:", GetLastError());
+    }
 }
 
 /**