summaryrefslogtreecommitdiffstats
path: root/hacks/ximage-loader.c
diff options
context:
space:
mode:
authorSimon Rettberg2019-02-18 11:55:41 +0100
committerSimon Rettberg2019-02-18 11:55:41 +0100
commitae69a754244c4e475c8d2591772ca8e005071d83 (patch)
tree58b3fa7abc2dcfe3c23e1c0ce108950c720826ab /hacks/ximage-loader.c
parentUpdate gitignore (diff)
downloadxscreensaver-ae69a754244c4e475c8d2591772ca8e005071d83.tar.gz
xscreensaver-ae69a754244c4e475c8d2591772ca8e005071d83.tar.xz
xscreensaver-ae69a754244c4e475c8d2591772ca8e005071d83.zip
Update to 5.42
Diffstat (limited to 'hacks/ximage-loader.c')
-rw-r--r--hacks/ximage-loader.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/hacks/ximage-loader.c b/hacks/ximage-loader.c
index 382699b..cb86ab3 100644
--- a/hacks/ximage-loader.c
+++ b/hacks/ximage-loader.c
@@ -87,8 +87,13 @@ make_ximage (Display *dpy, Visual *visual, const char *filename,
g_type_init ();
# endif
# endif
- gdk_pixbuf_xlib_init (dpy, DefaultScreen (dpy));
- xlib_rgb_init (dpy, DefaultScreenOfDisplay (dpy));
+ if (dpy)
+ {
+ /* Turns out gdk-pixbuf works even if you don't have display
+ connection, which is good news for analogtv-cli. */
+ gdk_pixbuf_xlib_init (dpy, DefaultScreen (dpy));
+ xlib_rgb_init (dpy, DefaultScreenOfDisplay (dpy));
+ }
initted = 1;
}
@@ -119,6 +124,7 @@ make_ximage (Display *dpy, Visual *visual, const char *filename,
pb = gdk_pixbuf_new_from_stream (s, 0, &gerr);
g_input_stream_close (s, NULL, NULL);
+ /* #### valgrind on xflame says there's a small leak in s? */
g_object_unref (s);
if (! pb)
@@ -198,6 +204,7 @@ make_ximage (Display *dpy, Visual *visual, const char *filename,
row += stride;
}
+ /* #### valgrind on xflame says there's a small leak in pb? */
g_object_unref (pb);
return image;
}