[m-rev.] [PATCH 05/11] mercury_cairo: Increment reference count in get_group_target.
Peter Wang
novalazy at gmail.com
Fri Sep 4 12:00:53 AEST 2015
extras/graphics/mercury_cairo/cairo.m:
`get_group_target' was missing a reference count increment
analogous to that in `get_target'.
---
extras/graphics/mercury_cairo/cairo.m | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/extras/graphics/mercury_cairo/cairo.m b/extras/graphics/mercury_cairo/cairo.m
index 8863fd1..8ab981e 100644
--- a/extras/graphics/mercury_cairo/cairo.m
+++ b/extras/graphics/mercury_cairo/cairo.m
@@ -868,14 +868,14 @@ create_context(Surface, Context, !IO) :-
raw_surface = cairo_get_target(Ctxt->mcairo_raw_context);
/*
- ** The object returned by cairo_get_target() is owned by cairo,
- ** since we are keeping a reference to it we need to increment
+ ** The object returned by cairo_get_target() is owned by cairo.
+ ** Since we are keeping a reference to it we need to increment
** its reference count.
*/
raw_surface = cairo_surface_reference(raw_surface);
wrapped_surface = MR_GC_NEW(MCAIRO_surface);
wrapped_surface->mcairo_raw_surface = raw_surface;
- MR_GC_register_finalizer(wrapped_surface, MCAIRO_finalize_surface, 0);
+ MR_GC_register_finalizer(wrapped_surface, MCAIRO_finalize_surface, 0);
Target = (MR_Word) wrapped_surface;
").
@@ -920,9 +920,15 @@ create_context(Surface, Context, !IO) :-
MCAIRO_surface *wrapped_surface;
raw_surface = cairo_get_group_target(Ctxt->mcairo_raw_context);
+ /*
+ ** The object returned by cairo_get_group_target() is owned by cairo.
+ ** Since we are keeping a reference to it we need to increment
+ ** its reference count.
+ */
+ raw_surface = cairo_surface_reference(raw_surface);
wrapped_surface = MR_GC_NEW(MCAIRO_surface);
wrapped_surface->mcairo_raw_surface = raw_surface;
- MR_GC_register_finalizer(wrapped_surface, MCAIRO_finalize_surface, 0);
+ MR_GC_register_finalizer(wrapped_surface, MCAIRO_finalize_surface, 0);
Target = (MR_Word) wrapped_surface;
").
--
2.1.2
More information about the reviews
mailing list