[Fontconfig] Add a new function 'FcPatternRefCount'

Frederick Virchanza Gotham cauldwell.thomas at gmail.com
Mon Jun 5 08:18:53 UTC 2023


I propose adding the following function to libfontconfig:

int FcPatternRefCount(FcPattern const *const p)
{
    if ( !p ) return 0;
    return p->ref.count;
}

so that we can destroy an FcPattern as follows:

    while ( FcPatternRefCount(p) ) FcPatternDestroy(p);

Actually just as I'm writing this, I realise that there would be a
race condition if two threads are simultaneously calling
FcPatternRefCount. So instead maybe just have:

    int FcPatternDestroyAll(FcPattern*);

which would destroy them all.


More information about the Fontconfig mailing list