2 commits - src/cairo-pdf-surface.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed May 22 20:42:06 UTC 2024
src/cairo-pdf-surface.c | 28 ++++++++++++++++------------
1 file changed, 16 insertions(+), 12 deletions(-)
New commits:
commit 4796138f398489839c01735e907feb6e85269b5c
Merge: f3b354245 e29bd3f64
Author: Adrian Johnson <ajohnson at redneon.com>
Date: Wed May 22 20:42:04 2024 +0000
Merge branch 'pdf-finish' into 'master'
pdf: return subset status and always cleanup
See merge request cairo/cairo!554
commit e29bd3f642488dd3cd45147572eedaab9c006cda
Author: Adrian Johnson <ajohnson at redneon.com>
Date: Wed May 22 07:34:30 2024 +0930
pdf: return subset status and always cleanup
_cairo_pdf_surface_finish() was not returning the status when
subsetting fails. Also ensure the surface is always cleaned up when
there is an error.
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index d4c6e39d9..720c63b2c 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -2699,16 +2699,18 @@ _cairo_pdf_surface_finish (void *abstract_surface)
status = _cairo_pdf_surface_open_object_stream (surface);
if (unlikely (status))
- return status;
+ goto CLEANUP;
/* Emit unbounded surfaces */
- _cairo_pdf_surface_write_patterns_and_smask_groups (surface, TRUE);
+ status = _cairo_pdf_surface_write_patterns_and_smask_groups (surface, TRUE);
+ if (unlikely (status))
+ goto CLEANUP;
_cairo_pdf_surface_clear (surface, TRUE);
- status = surface->base.status;
- if (status == CAIRO_STATUS_SUCCESS)
- status = _cairo_pdf_surface_emit_font_subsets (surface);
+ status = _cairo_pdf_surface_emit_font_subsets (surface);
+ if (unlikely (status))
+ goto CLEANUP;
/* Emit any new patterns or surfaces created by the Type 3 font subset. */
_cairo_pdf_surface_write_patterns_and_smask_groups (surface, TRUE);
@@ -2717,27 +2719,29 @@ _cairo_pdf_surface_finish (void *abstract_surface)
status = _cairo_pdf_surface_write_pages (surface);
if (unlikely (status))
- return status;
+ goto CLEANUP;
status = _cairo_pdf_interchange_write_document_objects (surface);
if (unlikely (status))
- return status;
+ goto CLEANUP;
status = _cairo_pdf_surface_write_page_dicts (surface);
if (unlikely (status))
- return status;
+ goto CLEANUP;
catalog = _cairo_pdf_surface_new_object (surface);
- if (catalog.id == 0)
- return _cairo_error (CAIRO_STATUS_NO_MEMORY);
+ if (catalog.id == 0) {
+ status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
+ goto CLEANUP;
+ }
status = _cairo_pdf_surface_write_catalog (surface, catalog);
if (unlikely (status))
- return status;
+ goto CLEANUP;
status = _cairo_pdf_surface_close_object_stream (surface);
if (unlikely (status))
- return status;
+ goto CLEANUP;
if (!surface->debug && surface->pdf_version >= CAIRO_PDF_VERSION_1_5)
{
More information about the cairo-commit
mailing list