]> git.0d.be Git - empathy.git/commitdiff
Don't leak a ref when updating notification bubble
authorWill Thompson <will.thompson@collabora.co.uk>
Wed, 12 Aug 2009 15:43:45 +0000 (16:43 +0100)
committerWill Thompson <will.thompson@collabora.co.uk>
Wed, 12 Aug 2009 16:35:07 +0000 (17:35 +0100)
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

index 0f835bc398112d1e49c13fc9a80ad8e25046c0ba..fb5a5c796f6c3495b3f0061e96d2f0284fce6892 100644 (file)
@@ -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);