cairo: Avoid GLib-GObject-CRITICAL from g_object_unref() on error path.
authorBen Pfaff <blp@gnu.org>
Sat, 6 Feb 2010 04:11:33 +0000 (20:11 -0800)
committerBen Pfaff <blp@gnu.org>
Sat, 6 Feb 2010 04:14:18 +0000 (20:14 -0800)
This could be triggered by an error creating the output file, e.g. by
tests/bugs/unwritable-dir.sh.

src/output/cairo.c

index 94dafd886b7914356b856701c09e6564269426b1..3584f30f575c4ef680d1d232ed3350f3e9e51ad3 100644 (file)
@@ -895,7 +895,8 @@ free_font (struct xr_font *font)
   if (font->desc != NULL)
     pango_font_description_free (font->desc);
   pango_font_metrics_unref (font->metrics);
-  g_object_unref (font->layout);
+  if (font->layout != NULL)
+    g_object_unref (font->layout);
 }
 
 /* Cairo driver class. */