Unconditionally destroy the old font, (otherwise, if the same font was selected twice in a row, a reference was lost to it, leading to assertion failures).

This commit is contained in:
Carl Worth 2004-11-13 19:46:18 +00:00
parent d29237e9c0
commit 2b76ec2d46
3 changed files with 15 additions and 22 deletions

View file

@ -1,3 +1,10 @@
2004-11-13 Carl Worth <cworth@cworth.org>
* src/cairo_gstate.c (_cairo_gstate_select_font): Unconditionally
destroy the old font, (otherwise, if the same font was selected
twice in a row, a reference was lost to it, leading to assertion
failures).
2004-11-12 Stuart Parmenter <pavlov@pavlov.net>
* src/cairo_gdip_font.cpp:
* src/cairo_gdip_surface.cpp: Added GDI+ backend to Cairo.

View file

@ -1992,21 +1992,14 @@ _cairo_gstate_select_font (cairo_gstate_t *gstate,
cairo_font_slant_t slant,
cairo_font_weight_t weight)
{
cairo_unscaled_font_t *tmp;
_cairo_unscaled_font_destroy (gstate->font);
tmp = _cairo_unscaled_font_create (family, slant, weight);
gstate->font = _cairo_unscaled_font_create (family, slant, weight);
if (tmp == NULL)
if (gstate->font == NULL)
return CAIRO_STATUS_NO_MEMORY;
if (gstate->font != tmp)
{
if (gstate->font != NULL)
_cairo_unscaled_font_destroy (gstate->font);
cairo_matrix_set_identity (&gstate->font_matrix);
gstate->font = tmp;
}
cairo_matrix_set_identity (&gstate->font_matrix);
return CAIRO_STATUS_SUCCESS;
}

View file

@ -1992,21 +1992,14 @@ _cairo_gstate_select_font (cairo_gstate_t *gstate,
cairo_font_slant_t slant,
cairo_font_weight_t weight)
{
cairo_unscaled_font_t *tmp;
_cairo_unscaled_font_destroy (gstate->font);
tmp = _cairo_unscaled_font_create (family, slant, weight);
gstate->font = _cairo_unscaled_font_create (family, slant, weight);
if (tmp == NULL)
if (gstate->font == NULL)
return CAIRO_STATUS_NO_MEMORY;
if (gstate->font != tmp)
{
if (gstate->font != NULL)
_cairo_unscaled_font_destroy (gstate->font);
cairo_matrix_set_identity (&gstate->font_matrix);
gstate->font = tmp;
}
cairo_matrix_set_identity (&gstate->font_matrix);
return CAIRO_STATUS_SUCCESS;
}