[gtk+/gtk-3-4] entry: guard for != NULL before unreffing the pixbuf
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-4] entry: guard for != NULL before unreffing the pixbuf
- Date: Mon, 9 Jul 2012 15:25:19 +0000 (UTC)
commit e99ac6c53171f6e5b9b67e12c8ffa42b50bdfe8b
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Sun Jul 8 00:27:30 2012 -0400
entry: guard for != NULL before unreffing the pixbuf
In gtk_entry_get_icon_pixbuf() we unreference the pixbuf that
_gtk_icon_helper_ensure_pixbuf() gives us back, since the function
doesn't return a reference, and by doing so we're able to return the
reference owned by the cached icon helper.
Since the icon helper method can return NULL though, if no icon
properties have been set on it, guard for != NULL before unreffing the
pixbuf, as that would cause a critical warning.
https://bugzilla.gnome.org/show_bug.cgi?id=679537
gtk/gtkentry.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index f5fa92d..1ea6b9c 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -7942,7 +7942,8 @@ gtk_entry_get_icon_pixbuf (GtkEntry *entry,
* the icon helper's cache ref directly.
*/
pixbuf = gtk_entry_ensure_pixbuf (entry, icon_pos);
- g_object_unref (pixbuf);
+ if (pixbuf)
+ g_object_unref (pixbuf);
return pixbuf;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]