diff options
author | Bastien Nocera <hadess@hadess.net> | 2017-07-27 13:14:10 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2017-07-27 13:14:10 +0100 |
commit | 57362ed4c1f37c05723e25e136327e262f32d35f (patch) | |
tree | e827792cc8170b85b92eeb7990fe076f0ed26eca /thumbnailer | |
parent | 3428b6d710bcd1ba5f8feb1346ed424dbf708c25 (diff) | |
download | gdk-pixbuf-57362ed4c1f37c05723e25e136327e262f32d35f.tar.gz |
thumbnailer: Update skeleton to fix a possible crash
If the loader returns a NULL pixbuf without returning an
error, the skeleton would crash trying to print the error.
Print that the thumbnailer is broken instead.
https://bugzilla.gnome.org/show_bug.cgi?id=778204
Diffstat (limited to 'thumbnailer')
-rw-r--r-- | thumbnailer/gnome-thumbnailer-skeleton.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/thumbnailer/gnome-thumbnailer-skeleton.c b/thumbnailer/gnome-thumbnailer-skeleton.c index d686432c2..73da53e07 100644 --- a/thumbnailer/gnome-thumbnailer-skeleton.c +++ b/thumbnailer/gnome-thumbnailer-skeleton.c @@ -37,6 +37,7 @@ static int output_size = 256; static gboolean g_fatal_warnings = FALSE; static char **filenames = NULL; +#if !GDK_PIXBUF_CHECK_VERSION(2,36,5) /** * gnome_desktop_thumbnail_scale_down_pixbuf: * @pixbuf: a #GdkPixbuf @@ -178,6 +179,7 @@ gnome_desktop_thumbnail_scale_down_pixbuf (GdkPixbuf *pixbuf, return dest_pixbuf; } +#endif static char * get_target_uri (GFile *file) @@ -291,9 +293,16 @@ int main (int argc, char **argv) scale = (double)output_size / MAX (width, height); +#if !GDK_PIXBUF_CHECK_VERSION(2,36,5) scaled = gnome_desktop_thumbnail_scale_down_pixbuf (pixbuf, floor (width * scale + 0.5), floor (height * scale + 0.5)); +#else + scaled = gdk_pixbuf_scale_simple (pixbuf, + floor (width * scale + 0.5), + floor (height * scale + 0.5), + GDK_INTERP_HYPER); +#endif gdk_pixbuf_copy_options (pixbuf, scaled); g_object_unref (pixbuf); pixbuf = scaled; @@ -316,8 +325,9 @@ int main (int argc, char **argv) g_free (input_filename); if (!pixbuf) { - g_warning ("Could not thumbnail '%s': %s", filenames[0], error->message); - g_error_free (error); + g_warning ("Could not thumbnail '%s': %s", filenames[0], + error ? error->message : "Thumbnailer failed without returning an error"); + g_clear_error (&error); g_strfreev (filenames); return 1; } |