[Fontconfig] The reference counter handling in FcConfigGetCurrent() and FcConfigReference().

Chris Wilson chris at chris-wilson.co.uk
Fri Jan 22 02:51:46 PST 2010

On Fri, 22 Jan 2010 06:57:39 +0900, mpsuzuki at hiroshima-u.ac.jp wrote:
> Hmm, if an application links multiple libraries that some
> of them call FcConfigGetCurrent() or FcInit() by themselves
> (so FcConfigGetCurrent() or FcInit() are called multiply),
> FcFini() should be called by the application to restrict
> only one freeing? Or, all libraries can call FcFini() by
> their own scope?

It would be a very bad design if any library attempted to finalize
another shared resource at a random point in time, for precisely the
reasons you have outlined.

Cleaning up of global state can only be performed by the application once
it has guaranteed that those resources are no longer in use - typically
during the shutdown of the last thread, primarily for the purposes of leak

Chris Wilson, Intel Open Source Technology Centre

More information about the Fontconfig mailing list