[cairo-commit] 2 commits - perf/cairo-perf-trace.c src/cairo-surface.c
Chris Wilson
ickle at kemper.freedesktop.org
Wed Jul 1 11:45:20 PDT 2009
perf/cairo-perf-trace.c | 5 ++---
src/cairo-surface.c | 4 +++-
2 files changed, 5 insertions(+), 4 deletions(-)
New commits:
commit 700a555d194a20c00df69b963cdc5b6153e162a4
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Jul 1 19:41:42 2009 +0100
[surface] Expose a SURFACE_TYPE_MISMATCH nil object
Gah, yet more error object bloat. Must finish cairo-object.
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 15fdde3..0b56b25 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -78,6 +78,7 @@ const cairo_surface_t name = { \
}
static DEFINE_NIL_SURFACE(CAIRO_STATUS_NO_MEMORY, _cairo_surface_nil);
+static DEFINE_NIL_SURFACE(CAIRO_STATUS_SURFACE_TYPE_MISMATCH, _cairo_surface_nil_surface_type_mismatch);
static DEFINE_NIL_SURFACE(CAIRO_STATUS_INVALID_CONTENT, _cairo_surface_nil_invalid_content);
static DEFINE_NIL_SURFACE(CAIRO_STATUS_INVALID_FORMAT, _cairo_surface_nil_invalid_format);
static DEFINE_NIL_SURFACE(CAIRO_STATUS_INVALID_VISUAL, _cairo_surface_nil_invalid_visual);
@@ -3169,6 +3170,8 @@ _cairo_surface_create_in_error (cairo_status_t status)
switch (status) {
case CAIRO_STATUS_NO_MEMORY:
return (cairo_surface_t *) &_cairo_surface_nil;
+ case CAIRO_STATUS_SURFACE_TYPE_MISMATCH:
+ return (cairo_surface_t *) &_cairo_surface_nil_surface_type_mismatch;
case CAIRO_STATUS_INVALID_CONTENT:
return (cairo_surface_t *) &_cairo_surface_nil_invalid_content;
case CAIRO_STATUS_INVALID_FORMAT:
@@ -3200,7 +3203,6 @@ _cairo_surface_create_in_error (cairo_status_t status)
case CAIRO_STATUS_INVALID_STRING:
case CAIRO_STATUS_INVALID_PATH_DATA:
case CAIRO_STATUS_SURFACE_FINISHED:
- case CAIRO_STATUS_SURFACE_TYPE_MISMATCH:
case CAIRO_STATUS_PATTERN_TYPE_MISMATCH:
case CAIRO_STATUS_INVALID_DASH:
case CAIRO_STATUS_INVALID_DSC_COMMENT:
commit 8f4611a94bda407b5944520b95599441a4ff5327
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Jul 1 19:39:57 2009 +0100
[perf] Fix use-after-free when retrieving error line number
We find out the status on destroying the script and then attempt to query
the defunct script for more info about the error. Wrong.
diff --git a/perf/cairo-perf-trace.c b/perf/cairo-perf-trace.c
index cc54649..d8d2f7a 100644
--- a/perf/cairo-perf-trace.c
+++ b/perf/cairo-perf-trace.c
@@ -254,6 +254,7 @@ execute (cairo_perf_t *perf,
for (i = 0; i < perf->iterations && ! user_interrupt; i++) {
cairo_script_interpreter_t *csi;
cairo_status_t status;
+ unsigned int line_no;
csi = cairo_script_interpreter_create ();
cairo_script_interpreter_install_hooks (csi, &hooks);
@@ -268,12 +269,10 @@ execute (cairo_perf_t *perf,
times[i] = cairo_perf_timer_elapsed ();
cairo_script_interpreter_finish (csi);
+ line_no = cairo_script_interpreter_get_line_number (csi);
status = cairo_script_interpreter_destroy (csi);
if (status) {
if (perf->summary) {
- unsigned int line_no;
-
- line_no = cairo_script_interpreter_get_line_number (csi);
fprintf (perf->summary, "Error during replay, line %d: %s\n",
line_no,
cairo_status_to_string (status));
More information about the cairo-commit
mailing list