From 024008efc7dea7d188a453974fb70f694b1d6bfb Mon Sep 17 00:00:00 2001 From: Christian Hammond Date: Thu, 15 Feb 2007 10:45:40 +0000 Subject: [PATCH] Prevent a crash when the handler for a notification's closed signal removes the last reference to the notification. We attempted to set the ID of the notification after emitting this signal, but the notification was destroyed already. So, keep a reference while doing all this. This fixes bug #116. --- ChangeLog | 9 +++++++++ libnotify/notification.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d7800f3..e6da548 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Thu Feb 15 02:44:16 PST 2007 Christian Hammond + + * libnotify/notification.c: + - Prevent a crash when the handler for a notification's closed signal + removes the last reference to the notification. We attempted to set + the ID of the notification after emitting this signal, but the + notification was destroyed already. So, keep a reference while doing + all this. This fixes bug #116. + Thu Feb 15 02:29:01 PST 2007 Christian Hammond * libnotify/notify.c: diff --git a/libnotify/notification.c b/libnotify/notification.c index aee5979..c9de255 100644 --- a/libnotify/notification.c +++ b/libnotify/notification.c @@ -675,9 +675,10 @@ _close_signal_handler(DBusGProxy *proxy, guint32 id, { if (id == notification->priv->id) { + g_object_ref(G_OBJECT(notification)); g_signal_emit(notification, signals[SIGNAL_CLOSED], 0); - notification->priv->id = 0; + g_object_unref(G_OBJECT(notification)); } }