summaryrefslogtreecommitdiff
path: root/test/paint-repeat.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2010-04-27 21:04:52 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2010-04-28 08:39:21 +0100
commitd3c4349730be991db0c85094103c744fc2d94836 (patch)
tree51000654083972900fd7346a8c03ccf8901a3aeb /test/paint-repeat.c
parenta5f54e48e3136076f3c8c60fc068f6a2105d9a33 (diff)
downloadcairo-d3c4349730be991db0c85094103c744fc2d94836.tar.gz
test: Mark surfaces as finished if the data goes out of scope.
The issue being that as the on-stack data is being referenced via a zero-copy snapshot outside of the functions scope as the surface is only finished and the source written long after the draw() returns. The correct procedure is that the user must call cairo_surface_finish() prior to any surface becoming inaccessible. In this case, this triggers the snapshot to preserve a copy of the data whilst it is still valid.
Diffstat (limited to 'test/paint-repeat.c')
-rw-r--r--test/paint-repeat.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/test/paint-repeat.c b/test/paint-repeat.c
index 35b383c47..c48d84c0e 100644
--- a/test/paint-repeat.c
+++ b/test/paint-repeat.c
@@ -47,6 +47,7 @@ draw (cairo_t *cr, int width, int height)
cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT);
cairo_paint (cr);
+ cairo_surface_finish (surface); /* data will go out of scope */
cairo_surface_destroy (surface);
return CAIRO_TEST_SUCCESS;