[gnome-power-manager] Fix crash in gpm_manager_notification_closed_cb



commit e20a3e1beeab6b6b0e089ed1ecfd6e4fa6cf27f5
Author: Richard Hughes <richard hughsie com>
Date:   Tue Jul 21 17:43:57 2009 +0100

    Fix crash in gpm_manager_notification_closed_cb
    
    libnotify stupidly unrefs the client object when it is detroyed, so just set the class to NULL in this case

 src/gpm-manager.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/gpm-manager.c b/src/gpm-manager.c
index db023c4..6030fa0 100644
--- a/src/gpm-manager.c
+++ b/src/gpm-manager.c
@@ -354,10 +354,11 @@ out:
  * gpm_manager_notification_closed_cb:
  **/
 static void
-gpm_manager_notification_closed_cb (NotifyNotification *notification, GpmManager *manager)
+gpm_manager_notification_closed_cb (NotifyNotification *notification, NotifyNotification **notification_class)
 {
 	egg_debug ("caught notification closed signal %p", notification);
-	g_object_unref (notification);
+	/* the object is already unreffed in _close_signal_handler */
+	*notification_class = NULL;
 }
 
 /**
@@ -383,7 +384,7 @@ gpm_manager_notify (GpmManager *manager, NotifyNotification **notification_class
 		notification = notify_notification_new (title, message, icon, NULL);
 	notify_notification_set_timeout (notification, timeout);
 	notify_notification_set_urgency (notification, urgency);
-	g_signal_connect (notification, "closed", G_CALLBACK (gpm_manager_notification_closed_cb), manager);
+	g_signal_connect (notification, "closed", G_CALLBACK (gpm_manager_notification_closed_cb), notification_class);
 
 	egg_debug ("notification %p: %s : %s", notification, title, message);
 



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