Peer to peer D-BUS / gLib

James Kent James.Kent at palmsource.com
Mon Feb 20 11:02:30 PST 2006


I was able to modify the example in dbus-0.60/glib/examples to work with peer-to-peer communication between the client and service processes but ran into two issues.

First, I hit a NULL pointer dereference in glib/dbus-gproxy.c in the function dbus_g_proxy_constructor.  In the peer-to-peer case, proxy->name is NULL, causing the line:

  proxy->for_owner = (proxy->name[0] == ':');

to deref the NULL pointer.  Replacing this line with:

  if (proxy->name == NULL)
    proxy->for_owner = TRUE;
  else
    proxy->for_owner = (proxy->name[0] == ':');

fixes the problem.

Second, I still had to use the internal macro DBUS_G_CONNECTION_FROM_CONNECTION in one place, in the server process's connection handler.  I'd like to suggest that the signature of the function dbus_connection_setup_with_g_main be changed from:

void            dbus_connection_setup_with_g_main (DBusConnection  *connection,
                                                   GMainContext    *context);

to:

DBusGConnection* dbus_connection_setup_with_g_main (DBusConnection  *connection,
                                                   GMainContext    *context);

That would have allowed me to access the DBusGConnection pointer I needed.

If you would like to include the modified sample using peer-to-peer direct connections in the glib/examples distribution, let me know.

Jim


More information about the dbus mailing list