From 1441e165f2338bc6a8e2945baca77611ff417b2f Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Sun, 2 Dec 2007 00:50:28 +1030 Subject: [PATCH] Fix regression in Type1 Fallback As a result of the changes to improve the status checking, _cairo_type2_charstrings_init() was failing due to the failure status returned when the font->output stream is destroyed. This is because _cairo_type2_charstrings_init() does not create an output stream. Fix this by initializing font->output to NULL and only destroy it if not NULL. --- src/cairo-type1-fallback.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cairo-type1-fallback.c b/src/cairo-type1-fallback.c index 626c7b5d3..3532692ce 100644 --- a/src/cairo-type1-fallback.c +++ b/src/cairo-type1-fallback.c @@ -110,6 +110,7 @@ cairo_type1_font_create (cairo_scaled_font_subset_t *scaled_font_subset, goto fail; _cairo_array_init (&font->contents, sizeof (unsigned char)); + font->output = NULL; *subset_return = font; @@ -709,12 +710,13 @@ cairo_type1_font_generate (cairo_type1_font_t *font, const char *name) static cairo_status_t cairo_type1_font_destroy (cairo_type1_font_t *font) { - cairo_status_t status; + cairo_status_t status = CAIRO_STATUS_SUCCESS; free (font->widths); cairo_scaled_font_destroy (font->type1_scaled_font); _cairo_array_fini (&font->contents); - status = _cairo_output_stream_destroy (font->output); + if (font->output) + status = _cairo_output_stream_destroy (font->output); free (font); return status;