mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2025-12-25 08:20:10 +01:00
[test] Handle memfaults during surface-finish-twice
Check and report memory allocation failures.
This commit is contained in:
parent
f12d52bfca
commit
82cccb2672
1 changed files with 11 additions and 6 deletions
|
|
@ -45,21 +45,26 @@
|
||||||
static cairo_test_status_t
|
static cairo_test_status_t
|
||||||
draw (cairo_t *cr, int width, int height)
|
draw (cairo_t *cr, int width, int height)
|
||||||
{
|
{
|
||||||
|
const cairo_test_context_t *ctx = cairo_test_get_context (cr);
|
||||||
cairo_surface_t *surface;
|
cairo_surface_t *surface;
|
||||||
|
cairo_status_t status;
|
||||||
|
|
||||||
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1);
|
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1);
|
||||||
|
|
||||||
cairo_surface_finish (surface);
|
cairo_surface_finish (surface);
|
||||||
if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS)
|
status = cairo_surface_status (surface);
|
||||||
return CAIRO_TEST_FAILURE;
|
if (status != CAIRO_STATUS_SUCCESS)
|
||||||
|
return cairo_test_status_from_status (ctx, status);
|
||||||
|
|
||||||
cairo_surface_finish (surface);
|
cairo_surface_finish (surface);
|
||||||
if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS)
|
status = cairo_surface_status (surface);
|
||||||
return CAIRO_TEST_FAILURE;
|
if (status != CAIRO_STATUS_SUCCESS)
|
||||||
|
return cairo_test_status_from_status (ctx, status);
|
||||||
|
|
||||||
cairo_surface_finish (surface);
|
cairo_surface_finish (surface);
|
||||||
if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS)
|
status = cairo_surface_status (surface);
|
||||||
return CAIRO_TEST_FAILURE;
|
if (status != CAIRO_STATUS_SUCCESS)
|
||||||
|
return cairo_test_status_from_status (ctx, status);
|
||||||
|
|
||||||
cairo_surface_destroy (surface);
|
cairo_surface_destroy (surface);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue