[GB.DBUS]

* BUG: Fix memory leaks in DBus error management.


git-svn-id: svn://localhost/gambas/trunk@4414 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2012-01-21 20:10:45 +00:00
parent 34f24c3991
commit 62c2a02cb6
3 changed files with 11 additions and 5 deletions

View file

@ -32,10 +32,8 @@ static CDBUSCONNECTION *_session = NULL;
static DBusConnection *get_bus(DBusBusType type)
{
DBusConnection *conn;
DBusError error;
dbus_error_init (&error);
conn = dbus_bus_get(type, &error);
conn = dbus_bus_get(type, NULL);
if (!conn)
GB.Error("Cannot connect to the &1 bus", type == DBUS_BUS_SYSTEM ? "system" : "session");
else

View file

@ -112,7 +112,9 @@ static void update_match(CDBUSOBSERVER *_object, bool noerr)
dbus_bus_add_match(THIS->connection, match, &error);
if (dbus_error_is_set(&error))
{
if (!noerr) GB.Error("Cannot enable observer");
if (!noerr)
GB.Error("Cannot enable observer");
dbus_error_free(&error);
THIS->enabled = FALSE;
DBUS_watch(THIS->connection, FALSE);
}
@ -124,7 +126,9 @@ static void update_match(CDBUSOBSERVER *_object, bool noerr)
dbus_bus_remove_match(THIS->connection, match, &error);
if (dbus_error_is_set(&error))
{
if (!noerr) GB.Error("Cannot disable observer");
if (!noerr)
GB.Error("Cannot disable observer");
dbus_error_free(&error);
THIS->enabled = TRUE;
DBUS_watch(THIS->connection, TRUE);
}

View file

@ -754,6 +754,7 @@ bool DBUS_call_method(DBusConnection *connection, const char *application, const
GB.Error("&1: &2", error.name, error.message);
if (reply)
dbus_message_unref(reply);
dbus_error_free(&error);
goto __RETURN;
}
@ -939,6 +940,7 @@ char *DBUS_introspect(DBusConnection *connection, const char *application, const
if (dbus_error_is_set(&error))
{
GB.Error("&1: &2", error.name, error.message);
dbus_error_free(&error);
goto __RETURN;
}
@ -1068,6 +1070,7 @@ bool DBUS_register(DBusConnection *connection, const char *name, bool unique)
if (dbus_error_is_set(&error))
{
GB.Error("Unable to register application name");
dbus_error_free(&error);
return TRUE;
}
@ -1089,6 +1092,7 @@ bool DBUS_unregister(DBusConnection *connection, const char *name)
if (dbus_error_is_set(&error))
{
GB.Error("Unable to unregister application name");
dbus_error_free(&error);
return TRUE;
}