From 50c7d637f3a97031c5f4e2bc8d41d17e5397db45 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 13 Aug 2009 15:49:11 +0100 Subject: [PATCH] [trace] Emit an 'index' for an undefined surface Larry Ewing hit a bug in cairo-trace whereby it tried to create a similar surface referencing an undefined object. This fix checks whether the object has yet to be defined, and if not issues an index in order to copy the appropriate operand from the stack. --- util/cairo-trace/trace.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c index c021d2d56..fb3b94de0 100644 --- a/util/cairo-trace/trace.c +++ b/util/cairo-trace/trace.c @@ -3148,7 +3148,6 @@ cairo_surface_create_similar (cairo_surface_t *other, int width, int height) { cairo_surface_t *ret; - long other_id; long surface_id; ret = DLCALL (cairo_surface_create_similar, other, content, width, height); @@ -3156,21 +3155,21 @@ cairo_surface_create_similar (cairo_surface_t *other, _emit_line_info (); if (other != NULL && _write_lock ()) { - other_id = _get_surface_id (other); + Object *obj; + + obj = _get_object (SURFACE, other); if (_pop_operands_to (SURFACE, other)) { _consume_operand (); - _trace_printf ("%d %d //%s similar\n", - width, - height, - _content_to_string (content)); + } else if (obj->defined) { + _trace_printf ("s%ld", obj->token); } else { - _trace_printf ("s%ld %d %d //%s similar\n", - other_id, - width, - height, - _content_to_string (content)); + _trace_printf ("%d index ", current_stack_depth - obj->operand - 1); } + _trace_printf ("%d %d //%s similar\n", + width, + height, + _content_to_string (content)); _push_operand (SURFACE, ret); _write_unlock (); }