[cairo] [PATCH] fix bugs 15797 (1.8) and 18632 (master)

Paolo Bonzini bonzini at gnu.org
Tue Dec 9 06:45:32 PST 2008


Hi all, I tracked PR15797 and PR18632 to be caused by the same code of
cairo-quartz-surface.c.

In 1.8, CreateGradientFunction and CreateRepeatingGradientFunction (two
functions in the quartz backend) erroneously unbalance the reference
count of the pattern, causing PR15797.  This was fixed in commits
79446018 and 57551a91, but the fix caused PR18632 in turn because the
code now tries to increase the reference count of cairo-gstate.c's
stack-allocated patterns.

The fix in both cases is to avoid reference counting for the argument of
CreateGradientFunction and CreateRepeatingGradientFunction.  Since the
lifetime of the Quartz patterns for the source (created by
_cairo_quartz_setup_source and destroyed by
_cairo_quartz_teardown_source; _cairo_quartz_setup_source is what calls
the Create*GradientFunction functions instead) always coincides within
the execution of _cairo_quartz_setup_source's caller, we know that if
the source had a valid reference count upon _cairo_quartz_setup_source's
entrance, it will keep it until the surface is torn down.

The fixes are in my repository at
http://www.inf.unisi.ch/~bonzini/webdav/cairo.git in branches
fix-15797-1.8 and fix-18632 (no test case: the bug basically makes the
Quartz backend unusable with gradients).

Paolo



More information about the cairo mailing list