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.
This commit is contained in:
Adrian Johnson 2007-12-02 00:50:28 +10:30
parent e6166f7b44
commit 1441e165f2

View file

@ -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;