mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 02:58:02 +02:00
boilerplate: Fix use after free from 3ae5723
If we want to access the surface during the cleanup, we must hold our own reference to it. Make it so for the forced finish of the recording surface.
This commit is contained in:
parent
905c345df1
commit
b972669c9a
1 changed files with 10 additions and 3 deletions
|
|
@ -184,7 +184,14 @@ _cairo_boilerplate_recording_create_surface (const char *name,
|
|||
extents.y = 0;
|
||||
extents.width = width;
|
||||
extents.height = height;
|
||||
return *closure = cairo_recording_surface_create (content, &extents);
|
||||
return *closure = cairo_surface_reference (cairo_recording_surface_create (content, &extents));
|
||||
}
|
||||
|
||||
static void
|
||||
_cairo_boilerplate_recording_surface_cleanup (void *closure)
|
||||
{
|
||||
cairo_surface_finish (closure);
|
||||
cairo_surface_destroy (closure);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -351,7 +358,7 @@ static const cairo_boilerplate_target_t builtin_targets[] = {
|
|||
NULL, NULL,
|
||||
_cairo_boilerplate_get_image_surface,
|
||||
cairo_surface_write_to_png,
|
||||
(cairo_boilerplate_cleanup_t) cairo_surface_finish,
|
||||
_cairo_boilerplate_recording_surface_cleanup,
|
||||
NULL,
|
||||
FALSE, FALSE, TRUE
|
||||
},
|
||||
|
|
@ -363,7 +370,7 @@ static const cairo_boilerplate_target_t builtin_targets[] = {
|
|||
NULL, NULL,
|
||||
_cairo_boilerplate_get_image_surface,
|
||||
cairo_surface_write_to_png,
|
||||
(cairo_boilerplate_cleanup_t) cairo_surface_finish,
|
||||
_cairo_boilerplate_recording_surface_cleanup,
|
||||
NULL,
|
||||
FALSE, FALSE, TRUE
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue