Windows DBus shared memory name depends on _DEBUG?
Ralf Habacker
ralf.habacker at freenet.de
Wed Sep 22 02:57:11 PDT 2010
Am 22.09.2010 11:06, schrieb Thomas Sondergaard:
> Hi,
>
> I'm using D-Bus (master) with Qt on Windows and I'm experiencing that
> my debug builds, which link the debug version of QtDBus, which again
> link the debug version of libdbus, ie dbus-1d.dll, always starts a new
> session bus.
>
> I've discovered that the reason is that dbus-daemon.exe is built with
> release settings. This causes the name of the shared memory segment
> used to find the running server to be different, due to these lines in
> dbus-sysdeps-win.c:
>
> #ifdef _DEBUG
> static const char *cDBusDaemonAddressInfo = "DBusDaemonAddressInfoDebug";
> #else
> static const char *cDBusDaemonAddressInfo = "DBusDaemonAddressInfo";
> #endif
>
> What is the wisdom behind using a different shared memory address for
> dbus build with debugging enabled? If the different address is meant
> to allow the developer to experiment with a debugging build while at
> the same time running other software that uses a release version of
> dbus, I think it would make sense to make the address a configuration
> option.
This is guaranted by the autolaunch protocol. When using autolaunch
procotol in session bus config, dbus-daemon server automatically select
a free tcp port on localhost and saves this address in the related
shared memory segment. If the dbus client is configured using the
autolaunch protocol (which is the default on configure time) it fetches
the recent session dbus address from the related shared memory address.
Now debug and release builds could run independent dbus daemons.
One solution not to use the autolaunch procotol, another (probably
better solution) is applying the following patches
http://websvn.kde.org/*checkout*/trunk/kdesupport/emerge/portage/win32libs-sources/dbus-src/0001-Extended-autolaunch-protocol-with-scope-attribute.patch
http://websvn.kde.org/*checkout*/trunk/kdesupport/emerge/portage/win32libs-sources/dbus-src/0002-Fixed-case-when-no-scope-attribute-is-used.patch
They remove the release and debug distinction of the shared memory
address and allows the user to specific a dedicated autolaunched bus by
using the following bus address for the daemon and the client:
autolaunch:scope=<term>
where term is either
'install-path' to limit the bus to a specific install path or any other
term for other specific use cases.
With cmake this can be set on configure time by adding the following
define:
-DDBUS_SESSION_BUS_DEFAULT_ADDRESS:STRING=autolaunch:scope=<term>"
Regards
Ralf
More information about the dbus
mailing list