Maemo: Properly unregister the RPC callbacks.

This commit is contained in:
Tobias Brunner
2010-10-14 17:36:19 +02:00
parent 9f01ba4044
commit 6f59971371
2 changed files with 24 additions and 22 deletions
+18 -22
View File
@@ -532,34 +532,30 @@ strongswan_status_init (StrongswanStatus *plugin)
gtk_widget_show_all (GTK_WIDGET (plugin)); gtk_widget_show_all (GTK_WIDGET (plugin));
} }
#define UNREF_IF(obj) do { \
if (obj) { obj = (g_object_unref (obj), NULL); } \
} while(0)
static void static void
strongswan_status_dispose (GObject *object) strongswan_status_dispose (GObject *object)
{ {
StrongswanStatusPrivate *priv = STRONGSWAN_STATUS (object)->priv; StrongswanStatusPrivate *priv = STRONGSWAN_STATUS (object)->priv;
if (priv->conns) if (priv->context)
{ {
priv->conns = (g_object_unref (priv->conns), NULL); osso_rpc_unset_cb_f (priv->context,
} OSSO_STATUS_SERVICE,
if (priv->icons.status_open) OSSO_STATUS_OBJECT,
{ OSSO_STATUS_IFACE,
g_object_unref (priv->icons.status_open); (osso_rpc_cb_f*)dbus_req_handler,
priv->icons.status_open = NULL; STRONGSWAN_STATUS (object));
} osso_deinitialize (priv->context);
if (priv->icons.status_close) priv->context = NULL;
{
g_object_unref (priv->icons.status_close);
priv->icons.status_close = NULL;
}
if (priv->icons.button_open)
{
g_object_unref (priv->icons.button_open);
priv->icons.button_open = NULL;
}
if (priv->icons.button_close)
{
g_object_unref (priv->icons.button_close);
priv->icons.button_close = NULL;
} }
UNREF_IF(priv->conns);
UNREF_IF(priv->icons.status_open);
UNREF_IF(priv->icons.status_close);
UNREF_IF(priv->icons.button_open);
UNREF_IF(priv->icons.button_close);
G_OBJECT_CLASS (strongswan_status_parent_class)->dispose (object); G_OBJECT_CLASS (strongswan_status_parent_class)->dispose (object);
} }
@@ -318,6 +318,12 @@ METHOD(maemo_service_t, destroy, void,
} }
if (this->context) if (this->context)
{ {
osso_rpc_unset_cb_f(this->context,
OSSO_CHARON_SERVICE,
OSSO_CHARON_OBJECT,
OSSO_CHARON_IFACE,
(osso_rpc_cb_f*)dbus_req_handler,
this);
osso_deinitialize(this->context); osso_deinitialize(this->context);
} }
charon->bus->remove_listener(charon->bus, &this->public.listener); charon->bus->remove_listener(charon->bus, &this->public.listener);