From 5be65318a4cee0c69377973105c9ce86d6d72c81 Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Thu, 24 Jun 2010 04:29:55 -0400 Subject: [PATCH] Disconnect the proxy destroy signal handler --- libnotify/notification.c | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/libnotify/notification.c b/libnotify/notification.c index 7ad2acf..b4fcb1e 100644 --- a/libnotify/notification.c +++ b/libnotify/notification.c @@ -382,6 +382,23 @@ notify_notification_init (NotifyNotification *obj) (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 notify_notification_finalize (GObject *object) { @@ -415,6 +432,10 @@ notify_notification_finalize (GObject *object) proxy = _notify_get_g_proxy (); 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, "NotificationClosed", G_CALLBACK (_close_signal_handler), @@ -749,24 +770,6 @@ _gslist_to_string_array (GSList *list) 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: * @notification: The notification.