mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 00:38:06 +02:00
Don't crash if backend->create_similar returns a nil surface
This fixes the bug reported here: cairo crashes in cairo_create_simular if nil surface returned by other->backend->create_similar https://bugs.freedesktop.org/show_bug.cgi?id=9844
This commit is contained in:
parent
b0c086fce4
commit
4e0f0d9425
1 changed files with 9 additions and 2 deletions
|
|
@ -219,10 +219,17 @@ _cairo_surface_create_similar_scratch (cairo_surface_t *other,
|
|||
if (other->status)
|
||||
return (cairo_surface_t*) &_cairo_surface_nil;
|
||||
|
||||
if (other->backend->create_similar)
|
||||
if (other->backend->create_similar) {
|
||||
surface = other->backend->create_similar (other, content, width, height);
|
||||
/* It's not an error if the backend didn't create a valid
|
||||
* surface---it may just not be supported. */
|
||||
if (surface && surface->status) {
|
||||
cairo_surface_destroy (surface);
|
||||
surface = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (!surface)
|
||||
if (surface == NULL)
|
||||
surface = cairo_image_surface_create (format, width, height);
|
||||
|
||||
cairo_surface_get_font_options (other, &options);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue