[cairo] A potential issue in cairo-recording-surface.c

Zozó Teki teknos at gmail.com
Fri Nov 9 11:44:50 PST 2012


I have noticed that some of my objects were  lost when drawing them on
a recording surface and playing them back. After doing some debugging
I found that they are not properly added to the bbtree during
playback. (Later elements with the same extents as a prior one tend to
disappear from the chain of headers having similar extents.)

I have prepared the below patch (against 1.12.8), which fixes the
issue for me. (It properly prepends “header” with its full chain to

I am not a regular cairo contributor, this is the first time I am
submitting a patch, so I am not sure this is the proper way or whom to
contact to discuss this issue.


--- src/cairo-recording-surface.c original
+++ src/cairo-recording-surface.c updated
@@ -210,7 +210,10 @@
     if (box->p1.x == bbt->extents.p1.x && box->p1.y == bbt->extents.p1.y &&
               box->p2.x == bbt->extents.p2.x && box->p2.y == bbt->extents.p2.y)
-              header->chain = bbt->chain;
+    cairo_command_header_t *last = header;
+    while (last->chain)
+        last = last->chain;
+             last->chain = bbt->chain;
               bbt->chain = header;
               return CAIRO_STATUS_SUCCESS;

More information about the cairo mailing list