Hey >> to allow FcFini to be called the same number of times than FcInit, here >> is a patch that uses a ref count in these 2 functions. > > Comments below. > >> @@ -119,14 +121,20 @@ FcInit (void) >> { >> FcConfig *config; >> >> + if (!_fcInitCount) >> + { >> + if (_fcConfig) >> + return FcTrue; >> + config = FcInitLoadConfigAndFonts (); >> + if (!config) >> + return FcFalse; >> + FcConfigSetCurrent (config); >> + if (FcDebug()& FC_DBG_MEMORY) >> + FcMemReport (); >> + } >> + >> + _fcInitCount++; >> return FcTrue; >> } > > Currently one can do FcConfigDestroy(FcConfigGetCurrent()) to use a brand new > configuration (ie. reset the default configuration). However, everytime > doing that causes an internal invocation of FcInit() and increasing the > refcount. That's wrong. I think we need a separate bool and a non-ref'ing > _FcInit for the implicit initialization. The implicit initialization should > add up to only one reference. Which is the one the unpaired FcFini() > releases. > > Also, the two return paths in the conditional do not increase the refcount > and are hence wrong. For example, if one does a FcConfigSetCurrent(), then > the ref count will never increase and stay at zero. > > Fix those and I'll happily commit this :). i actually don't know all that internal code of fontconfig. If it's easy for you, then please add such refcounting. It will take me a lot of time (and i don't have a lot, as i already work on several projects) regards Vincent Torri _______________________________________________ Fontconfig mailing list Fontconfig@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/fontconfig