diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2009-08-05 05:29:56 +0800 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2009-08-05 05:35:54 +0800 |
commit | faef8889c4331af839cbec91691fe97ade60f9f7 (patch) | |
tree | 6469d6745819702996b3fca426f117e7e4145ac2 /src/empathy-chat-window.c | |
parent | 485ccb5ac65dc8beccd511c9575c3f58ae52d047 (diff) | |
download | gsoc2013-empathy-faef8889c4331af839cbec91691fe97ade60f9f7.tar gsoc2013-empathy-faef8889c4331af839cbec91691fe97ade60f9f7.tar.gz gsoc2013-empathy-faef8889c4331af839cbec91691fe97ade60f9f7.tar.bz2 gsoc2013-empathy-faef8889c4331af839cbec91691fe97ade60f9f7.tar.lz gsoc2013-empathy-faef8889c4331af839cbec91691fe97ade60f9f7.tar.xz gsoc2013-empathy-faef8889c4331af839cbec91691fe97ade60f9f7.tar.zst gsoc2013-empathy-faef8889c4331af839cbec91691fe97ade60f9f7.zip |
Don't try to free NULL pixbufs.
It's all very well to ensure that we don't pass a NULL pixbuf to
libnotify, but we shouldn't then try to g_object_unref () the pointer
without checking it's not NULL.
Diffstat (limited to 'src/empathy-chat-window.c')
-rw-r--r-- | src/empathy-chat-window.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c index 3e77553b3..bde0e215e 100644 --- a/src/empathy-chat-window.c +++ b/src/empathy-chat-window.c @@ -969,28 +969,26 @@ chat_window_show_or_update_notification (EmpathyChatWindow *window, body = empathy_message_get_body (message); escaped = g_markup_escape_text (body, -1); - pixbuf = empathy_misc_get_pixbuf_for_notification (sender, EMPATHY_IMAGE_NEW_MESSAGE); - if (priv->notification != NULL) { notify_notification_update (priv->notification, header, escaped, NULL); - /* if icon doesn't exist libnotify will crash */ - if (pixbuf != NULL) - notify_notification_set_icon_from_pixbuf (priv->notification, pixbuf); } else { priv->notification = notify_notification_new (header, escaped, NULL, NULL); notify_notification_set_timeout (priv->notification, NOTIFY_EXPIRES_DEFAULT); - /* if icon doesn't exist libnotify will crash */ - if (pixbuf != NULL) - notify_notification_set_icon_from_pixbuf (priv->notification, pixbuf); g_signal_connect (priv->notification, "closed", G_CALLBACK (chat_window_notification_closed_cb), cb_data); } + pixbuf = empathy_misc_get_pixbuf_for_notification (sender, EMPATHY_IMAGE_NEW_MESSAGE); + + if (pixbuf != NULL) { + notify_notification_set_icon_from_pixbuf (priv->notification, pixbuf); + g_object_unref (pixbuf); + } + notify_notification_show (priv->notification, NULL); - g_object_unref (pixbuf); g_free (escaped); } |