summaryrefslogtreecommitdiff
path: root/test/translate-show-surface.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/translate-show-surface.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/translate-show-surface.c')
-rw-r--r--test/translate-show-surface.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/test/translate-show-surface.c b/test/translate-show-surface.c
index bf084feab..9f7af8db2 100644
--- a/test/translate-show-surface.c
+++ b/test/translate-show-surface.c
@@ -64,6 +64,7 @@ draw (cairo_t *cr, int width, int height)
cairo_paint (cr);
}
cairo_restore (cr);
+ cairo_surface_finish (surface); /* colors will go out of scope */
cairo_surface_destroy (surface);
}