summaryrefslogtreecommitdiff
path: root/modules/engines/pixbuf/pixbuf-render.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/engines/pixbuf/pixbuf-render.c')
-rw-r--r--modules/engines/pixbuf/pixbuf-render.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/modules/engines/pixbuf/pixbuf-render.c b/modules/engines/pixbuf/pixbuf-render.c
index 6fb93bc495..1b2fd991c8 100644
--- a/modules/engines/pixbuf/pixbuf-render.c
+++ b/modules/engines/pixbuf/pixbuf-render.c
@@ -492,8 +492,25 @@ theme_pixbuf_new (void)
void
theme_pixbuf_destroy (ThemePixbuf *theme_pb)
{
- theme_pixbuf_set_filename (theme_pb, NULL);
- g_free (theme_pb);
+ if (G_LIKELY (theme_pb))
+ {
+ theme_pixbuf_set_filename (theme_pb, NULL);
+ g_free (theme_pb);
+ }
+}
+
+void
+theme_clear_pixbuf (ThemePixbuf **theme_pb)
+{
+#if GLIB_CHECK_VERSION (2, 34, 0)
+ g_clear_pointer (theme_pb, theme_pixbuf_destroy);
+#else
+ if (*theme_pb)
+ {
+ theme_pixbuf_destroy (*theme_pb);
+ *theme_pb = NULL;
+ }
+#endif
}
void