From 2617d68a7b7ccaa8d82fe225926a1bf5f160ed30 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 15 Sep 2008 17:07:11 +0100 Subject: [PATCH] [boilerplate] Restrict number of retries to create an error surface. Sometimes we just cannot get what we want, so give up - it's only an error surface after all! --- boilerplate/cairo-boilerplate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/boilerplate/cairo-boilerplate.c b/boilerplate/cairo-boilerplate.c index c32b09bc8..f7146b745 100644 --- a/boilerplate/cairo-boilerplate.c +++ b/boilerplate/cairo-boilerplate.c @@ -643,6 +643,7 @@ cairo_surface_t * cairo_boilerplate_surface_create_in_error (cairo_status_t status) { cairo_surface_t *surface = NULL; + int loop = 5; do { cairo_surface_t *intermediate; @@ -657,9 +658,9 @@ cairo_boilerplate_surface_create_in_error (cairo_status_t status) cairo_append_path (cr, &path); cairo_surface_destroy (surface); - surface = cairo_get_target (cr); + surface = cairo_surface_reference (cairo_get_target (cr)); cairo_destroy (cr); - } while (cairo_surface_status (surface) != status); + } while (cairo_surface_status (surface) != status && --loop); return surface; }