[empathy] Don't leak a ref when updating notification bubble



commit 03480a1e9b3e6886bef8346c4b73d8dd93b8e238
Author: Will Thompson <will thompson collabora co uk>
Date:   Wed Aug 12 16:43:45 2009 +0100

    Don't leak a ref when updating notification bubble
    
    This meant that if a notification bubble for a tab had ever been
    updated, closing the tab would not destroy the EmpathyChat, or indeed
    close the Channel. New messages would be logged, but not presented to
    the user. Reopening a tab to the same channel would work, but sending a
    message would assert.
    
    I'm pretty sure this fixes #588840.

 src/empathy-chat-window.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index 0f835bc..fb5a5c7 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -946,7 +946,6 @@ chat_window_show_or_update_notification (EmpathyChatWindow *window,
 	char *escaped;
 	const char *body;
 	GdkPixbuf *pixbuf;
-	NotificationData *cb_data;
 	EmpathyChatWindowPriv *priv = GET_PRIV (window);
 	gboolean res;
 
@@ -960,10 +959,6 @@ chat_window_show_or_update_notification (EmpathyChatWindow *window,
 		}
 	}
 
-	cb_data = g_slice_new0 (NotificationData);
-	cb_data->chat = g_object_ref (chat);
-	cb_data->window = window;
-
 	sender = empathy_message_get_sender (message);
 	header = empathy_contact_get_name (sender);
 	body = empathy_message_get_body (message);
@@ -973,6 +968,11 @@ chat_window_show_or_update_notification (EmpathyChatWindow *window,
 		notify_notification_update (priv->notification,
 					    header, escaped, NULL);
 	} else {
+		NotificationData *cb_data = cb_data = g_slice_new0 (NotificationData);
+
+		cb_data->chat = g_object_ref (chat);
+		cb_data->window = window;
+
 		priv->notification = notify_notification_new (header, escaped, NULL, NULL);
 		notify_notification_set_timeout (priv->notification, NOTIFY_EXPIRES_DEFAULT);
 



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