[libnotify] Disconnect the proxy destroy signal handler



commit 5be65318a4cee0c69377973105c9ce86d6d72c81
Author: William Jon McCann <jmccann redhat com>
Date:   Thu Jun 24 04:29:55 2010 -0400

    Disconnect the proxy destroy signal handler

 libnotify/notification.c |   39 +++++++++++++++++++++------------------
 1 files 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
@@ -383,6 +383,23 @@ notify_notification_init (NotifyNotification *obj)
 }
 
 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)
 {
         NotifyNotification        *obj = NOTIFY_NOTIFICATION (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.



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