Enlightenment CVS committal

Author  : ulisses
Project : e17
Module  : libs/e_dbus

Dir     : e17/libs/e_dbus/src/lib/dbus


Modified Files:
        e_dbus.c 


Log Message:
Fix segfault when using private buses (other than system and session).

When using private buses in Python (with python-e_dbus and python-dbus) the
program always segfaults trying to setup the integration of D-Bus with Ecore
mainloop. The problem is by the time the setup function is called the
connection with the private bus is not registered yet and then we're
segfaulting at this line of e_dbus_connection_new():

  cd->conn_name = strdup(dbus_bus_get_unique_name(conn));

This patch just adds a test to see if we're already registered or not. However,
we need to add proper support for private buses to e_dbus.

===================================================================
RCS file: /cvs/e/e17/libs/e_dbus/src/lib/dbus/e_dbus.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- e_dbus.c    24 Nov 2007 13:22:03 -0000      1.4
+++ e_dbus.c    25 Mar 2008 23:19:12 -0000      1.5
@@ -142,14 +142,20 @@
 e_dbus_connection_new(DBusConnection *conn)
 {
   E_DBus_Connection *cd;
+  const char *conn_name;
 
   cd = calloc(1, sizeof(E_DBus_Connection));
   if (!cd) return NULL;
 
   cd->conn = conn;
-  cd->conn_name = strdup(dbus_bus_get_unique_name(conn));
-
-  DEBUG(1, "Connected! Name: %s\n", cd->conn_name);
+  conn_name = dbus_bus_get_unique_name(conn);
+  if (conn_name)
+  {
+    DEBUG(1, "Connected! Name: %s\n", conn_name);
+    cd->conn_name = strdup(conn_name);
+  }
+  else
+    DEBUG(1, "Not connected\n");
 
   cd->shared_type = -1;
   cd->fd_handlers = ecore_list_new();



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to