Disconnect the proxy destroy signal handler

This commit is contained in:
William Jon McCann 2010-06-24 04:29:55 -04:00
parent 27a6e38bbf
commit 5be65318a4
1 changed files with 21 additions and 18 deletions

View File

@ -382,6 +382,23 @@ notify_notification_init (NotifyNotification *obj)
(GFreeFunc) destroy_pair); (GFreeFunc) destroy_pair);
} }
static void
on_proxy_destroy (DBusGProxy *proxy,
NotifyNotification *notification)
{
if (notification->priv->signals_registered) {
dbus_g_proxy_disconnect_signal (proxy,
"NotificationClosed",
G_CALLBACK (_close_signal_handler),
notification);
dbus_g_proxy_disconnect_signal (proxy,
"ActionInvoked",
G_CALLBACK (_action_signal_handler),
notification);
notification->priv->signals_registered = FALSE;
}
}
static void static void
notify_notification_finalize (GObject *object) notify_notification_finalize (GObject *object)
{ {
@ -415,6 +432,10 @@ notify_notification_finalize (GObject *object)
proxy = _notify_get_g_proxy (); proxy = _notify_get_g_proxy ();
if (proxy != NULL && priv->signals_registered) { if (proxy != NULL && priv->signals_registered) {
g_signal_handlers_disconnect_by_func (proxy,
G_CALLBACK (on_proxy_destroy),
object);
dbus_g_proxy_disconnect_signal (proxy, dbus_g_proxy_disconnect_signal (proxy,
"NotificationClosed", "NotificationClosed",
G_CALLBACK (_close_signal_handler), G_CALLBACK (_close_signal_handler),
@ -749,24 +770,6 @@ _gslist_to_string_array (GSList *list)
return (char **) g_array_free (a, FALSE); return (char **) g_array_free (a, FALSE);
} }
static void
on_proxy_destroy (DBusGProxy *proxy,
NotifyNotification *notification)
{
if (notification->priv->signals_registered) {
dbus_g_proxy_disconnect_signal (proxy,
"NotificationClosed",
G_CALLBACK (_close_signal_handler),
notification);
dbus_g_proxy_disconnect_signal (proxy,
"ActionInvoked",
G_CALLBACK (_action_signal_handler),
notification);
notification->priv->signals_registered = FALSE;
}
}
/** /**
* notify_notification_show: * notify_notification_show:
* @notification: The notification. * @notification: The notification.