[cairo-commit] cairo/src cairo.c,1.107,1.108
Carl Worth
commit at pdx.freedesktop.org
Fri Jun 17 11:24:26 PDT 2005
Committed by: cworth
Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv28566/src
Modified Files:
cairo.c
Log Message:
* src/cairo.c: (cairo_reference), (cairo_destroy): cairo_reference
and cairo_destroy shouldn't behave differently when cr->status
indicates an error. Fix this bug that just slipped back in.
* src/cairo.c: (cairo_restore): Remove useless conditional return
at the end of a void function.
* src/cairo.c: (cairo_get_source), (cairo_get_font_face),
(cairo_text_extents), (cairo_show_text), (cairo_text_path):
Fix so that after calling _cairo_error the most that any cairo
entry function ever does is return a previously computed value.
Index: cairo.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.c,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -d -r1.107 -r1.108
--- cairo.c 16 Jun 2005 19:20:46 -0000 1.107
+++ cairo.c 17 Jun 2005 18:24:24 -0000 1.108
@@ -81,6 +81,9 @@
* The purpose of this function is to allow the user to set a
* breakpoint in _cairo_error() to generate a stack trace for when the
* user causes cairo to detect an error.
+ *
+ * _cairo_error also calls the error notify callback function that the
+ * user may have set with cairo_set_error_notify.
**/
static void
_cairo_error (cairo_t *cr, cairo_status_t status)
@@ -169,9 +172,6 @@
void
cairo_reference (cairo_t *cr)
{
- if (cr->status)
- _cairo_error (cr, cr->status);
-
if (cr->ref_count == (unsigned int)-1)
return;
@@ -189,9 +189,6 @@
void
cairo_destroy (cairo_t *cr)
{
- if (cr->status)
- _cairo_error (cr, cr->status);
-
if (cr->ref_count == (unsigned int)-1)
return;
@@ -274,9 +271,6 @@
if (cr->gstate == NULL)
_cairo_error (cr, CAIRO_STATUS_INVALID_RESTORE);
-
- if (cr->status)
- return;
}
slim_hidden_def(cairo_restore);
@@ -492,8 +486,10 @@
cairo_get_source (cairo_t *cr)
{
if (cr->status) {
+ cairo_pattern_t *pattern;
+ pattern = _cairo_pattern_create_in_error (cr->status);
_cairo_error (cr, cr->status);
- return _cairo_pattern_create_in_error (cr->status);
+ return pattern;
}
return _cairo_gstate_get_source (cr->gstate);
@@ -1681,6 +1677,7 @@
/* XXX: When available:
return _cairo_font_face_create_in_error (cr->status);
*/
+ return NULL;
}
return font_face;
@@ -1847,18 +1844,18 @@
&glyphs, &num_glyphs);
if (cr->status) {
- _cairo_error (cr, cr->status);
if (glyphs)
free (glyphs);
+ _cairo_error (cr, cr->status);
return;
}
cr->status = _cairo_gstate_glyph_extents (cr->gstate, glyphs, num_glyphs, extents);
- if (cr->status)
- _cairo_error (cr, cr->status);
-
if (glyphs)
free (glyphs);
+
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
/**
@@ -1918,18 +1915,19 @@
&glyphs, &num_glyphs);
if (cr->status) {
- _cairo_error (cr, cr->status);
if (glyphs)
free (glyphs);
+ _cairo_error (cr, cr->status);
return;
}
cr->status = _cairo_gstate_show_glyphs (cr->gstate, glyphs, num_glyphs);
- if (cr->status)
- _cairo_error (cr, cr->status);
if (glyphs)
free (glyphs);
+
+ if (cr->status)
+ _cairo_error (cr, cr->status);
}
void
@@ -1964,20 +1962,21 @@
&glyphs, &num_glyphs);
if (cr->status) {
- _cairo_error (cr, cr->status);
if (glyphs)
free (glyphs);
+ _cairo_error (cr, cr->status);
return;
}
cr->status = _cairo_gstate_glyph_path (cr->gstate,
glyphs, num_glyphs,
&cr->path);
+ if (glyphs)
+ free (glyphs);
+
if (cr->status)
_cairo_error (cr, cr->status);
- if (glyphs)
- free (glyphs);
}
void
More information about the cairo-commit
mailing list