[Tracker] bug in tracker_dbus_init in tracker_dbus.c



Hallo all,

there is a bug in tracker_dbus.c, also the function tracker_dbus_init
is defined in the following way:
DBusConnection *
tracker_dbus_init (void)
{
        DBusError      error;
        DBusConnection *connection;

        dbus_error_init (&error);

        connection = dbus_bus_get (DBUS_BUS_SESSION, &error);

        if ((connection == NULL) || dbus_error_is_set (&error)) {
                tracker_log ("tracker_dbus_init() could not get the
session bus"); connection = NULL;
                goto out;
        }

        dbus_connection_setup_with_g_main (connection, NULL);

        if (!dbus_connection_register_object_path (connection,
TRACKER_OBJECT, &tracker_vtable, NULL)) {

                tracker_log ("could not register D-BUS handlers");
                connection = NULL;
                goto out;
        }

        dbus_error_init (&error);

        dbus_bus_request_name (connection, TRACKER_SERVICE, 0, &error);

        if (dbus_error_is_set (&error)) {
                tracker_log ("could not acquire service name due to
'%s'", error.message); connection = NULL;
                goto out;
        }

out:
        if (dbus_error_is_set (&error)) {
                dbus_error_free (&error);
        }

        dbus_connection_set_exit_on_disconnect (connection, FALSE);

        return connection;
}

the dbus_connection_set_exit_on_disconnect should be called only if
connecttion is not NULL:
void
dbus_connection_set_exit_on_disconnect (DBusConnection *connection,
                                        dbus_bool_t
exit_on_disconnect) {
  _dbus_return_if_fail (connection != NULL);

  CONNECTION_LOCK (connection);
  connection->exit_on_disconnect = exit_on_disconnect != FALSE;
  CONNECTION_UNLOCK (connection);
}

which result in messages like (if the tracker encounters some problem):

tracker_dbus_init() could not get the session bus

process 5945: arguments to dbus_connection_set_exit_on_disconnect()
were incorrect, assertion "connection != NULL" failed in file

dbus-connection.c line 2830. This is normally a bug in some application
using the D-Bus library. D-Bus not built with -rdynamic so unable to
print a backtrace 

also it is now called always and on any kind of failure with NULL, the
simplest solution is to have something like:
if (connection != NULL)
   dbus_connection_set_exit_on_disconnect (connection,FALSE);


Regards,
Gergan



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]