[cairo-commit] 3 commits - src/cairo-path-stroke.c test/rectilinear-stroke.c test/.valgrind-suppressions

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu Mar 1 15:36:32 PST 2007


 src/cairo-path-stroke.c     |   15 ++++++++-------
 test/.valgrind-suppressions |   19 +++++++++++++++++++
 test/rectilinear-stroke.c   |    8 ++++++++
 3 files changed, 35 insertions(+), 7 deletions(-)

New commits:
diff-tree 4b1f450f4cf056b4cc28502dcf72eaf54f257c3a (from dcdcb7ac2acf39c54da855b6a2af4d02a7165a24)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Mar 1 18:36:27 2007 -0500

    [test] Add more valgrind suppressions

diff --git a/test/.valgrind-suppressions b/test/.valgrind-suppressions
index 53d0a99..910dd59 100644
--- a/test/.valgrind-suppressions
+++ b/test/.valgrind-suppressions
@@ -1,4 +1,23 @@
 {
+   in dl.so
+   Memcheck:Cond
+   fun:_dl_relocate_object
+ }
+{
+   bugs in libpng/libz
+   Memcheck:Cond
+   obj:/usr/lib/libz.so.1.2.2.2
+   obj:/usr/lib/libz.so.1.2.2.2
+   fun:deflate
+ }
+{
+   bugs in libpng/libz
+   Memcheck:Cond
+   obj:/usr/lib/libz.so.1.2.3
+   obj:/usr/lib/libz.so.1.2.3
+   fun:deflate
+ }
+{
    cairo's write_png triggers apparent bugs in libpng/libz
    Memcheck:Cond
    obj:/usr/lib/libz.so.1.2.2.2
diff-tree dcdcb7ac2acf39c54da855b6a2af4d02a7165a24 (from 2acd5b52774e2324df3e6b5b07a0d2790df3a60b)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Mar 1 18:36:16 2007 -0500

    Fix leak in rectilinear stroking code
    
    The code was not cleaning up after itself when rejecting a path as
    rectilinear.

diff --git a/src/cairo-path-stroke.c b/src/cairo-path-stroke.c
index 958b95a..09bafbf 100644
--- a/src/cairo-path-stroke.c
+++ b/src/cairo-path-stroke.c
@@ -1282,16 +1282,17 @@ _cairo_path_fixed_stroke_rectilinear (ca
 					  NULL,
 					  _cairo_rectilinear_stroker_close_path,
 					  &rectilinear_stroker);
-    if (status) {
-	_cairo_traps_fini (traps);
-	return status;
-    }
+    if (status)
+	goto BAIL;
 
     status = _cairo_rectilinear_stroker_emit_segments (&rectilinear_stroker);
-    if (status)
-	return status;
+
+BAIL:
 
     _cairo_rectilinear_stroker_fini (&rectilinear_stroker);
 
-    return CAIRO_STATUS_SUCCESS;
+    if (status)
+	_cairo_traps_fini (traps);
+
+    return status;
 }
diff-tree 2acd5b52774e2324df3e6b5b07a0d2790df3a60b (from bd2cd2c868864d5ec2a2c2e4bf16ff406be8afe2)
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Mar 1 18:34:53 2007 -0500

    [test] Add leak-revealing path to rectilinear-stroke
    
    Based on this thread:
    http://lists.freedesktop.org/archives/cairo/2007-March/009860.html

diff --git a/test/rectilinear-stroke.c b/test/rectilinear-stroke.c
index 6ba3f1a..379284d 100644
--- a/test/rectilinear-stroke.c
+++ b/test/rectilinear-stroke.c
@@ -126,6 +126,14 @@ draw (cairo_t *cr, int width, int height
     /* Draw a closed-path rectangle */
     cairo_rectangle   (cr, 0.5, 12.5, 10.0, 10.0);
 
+    /* Draw a path that is rectilinear initially, but not completely */
+    /* We draw this out of the target window.  The bug that caused this
+     * addition was leaks if part of the path was rectilinear but not
+     * completely */
+    cairo_move_to     (cr,  3.0, 30.5);
+    cairo_rel_line_to (cr, -2.5,  0.0);
+    cairo_rel_line_to (cr, +2.5, +2.5);
+
     cairo_stroke (cr);
 
     return CAIRO_TEST_SUCCESS;


More information about the cairo-commit mailing list