Vincent Torri | 30 Mar 10:56
Picon

about FcFini


hey,

if i have understood correctly the code, it is possible to call several 
time FcInit, but FcFini can be called only once. That's a problem when 
several libraries use fontconfig (like poppler + qt)

Would it be possible to use a ref count for the initialisation / 
finalization of fontconfig ?

thank you

Vincent Torri
Behdad Esfahbod | 30 Mar 18:20
Favicon
Gravatar

Re: about FcFini

On 03/30/2009 04:56 AM, Vincent Torri wrote:
> hey,
>
> if i have understood correctly the code, it is possible to call several
> time FcInit, but FcFini can be called only once. That's a problem when
> several libraries use fontconfig (like poppler + qt)

Hi,

My understanding is that:

   * Calling FcInit() is optional.  All fontconfig entry points check and 
initialize the library if needed.

   * FcFini() is designed to only be called by debugging code from 
applications, not for normal use by other libraries.

> Would it be possible to use a ref count for the initialisation /
> finalization of fontconfig ?

It would be feasible if FcInit() was mandatory.  But when it's optional, I'm 
not sure how to define the semantics.  What will the implicit initialization 
do?  Increase the ref count or not?

behdad

> thank you
>
> Vincent Torri
(Continue reading)

Vincent Torri | 31 Mar 12:42
Picon

Re: about FcFini


hey,

>> if i have understood correctly the code, it is possible to call several
>> time FcInit, but FcFini can be called only once. That's a problem when
>> several libraries use fontconfig (like poppler + qt)
>
> Hi,
>
> My understanding is that:
>
>  * Calling FcInit() is optional.  All fontconfig entry points check and 
> initialize the library if needed.
>
>  * FcFini() is designed to only be called by debugging code from 
> applications, not for normal use by other libraries.
>
>> Would it be possible to use a ref count for the initialisation /
>> finalization of fontconfig ?
>
> It would be feasible if FcInit() was mandatory.  But when it's optional, I'm 
> not sure how to define the semantics.  What will the implicit initialization 
> do?  Increase the ref count or not?

do something like that:

static int _fontconfig_init_count = 0;

int FcIni()
{
(Continue reading)

Keith Packard | 30 Mar 18:37
Favicon
Gravatar

Re: about FcFini

On Mon, 2009-03-30 at 12:20 -0400, Behdad Esfahbod wrote:

>    * Calling FcInit() is optional.  All fontconfig entry points check and 
> initialize the library if needed.

FcFini was added so that valgrind output could be used to discover leaks
in fontconfig. Normal applications should not use it, although I can see
why they might want to (eliminate memory usage after a period of using
fontconfig).

>    * FcFini() is designed to only be called by debugging code from 
> applications, not for normal use by other libraries.

Even so, it seems like it should be fairly easy to make it mostly
harmless to call FcFini in normal application use.

> > Would it be possible to use a ref count for the initialisation /
> > finalization of fontconfig ?
> 
> It would be feasible if FcInit() was mandatory.  But when it's optional, I'm 
> not sure how to define the semantics.  What will the implicit initialization 
> do?  Increase the ref count or not?

It sounds fairly easy to me - FcFini wouldn't actually do anything until
the ref count hit zero.

We'd presumably need to add another FcFiniReallyDoStuff so that people
wanting the current valgrind behaviour could still get that.

Or, perhaps, we should add a separate function that would do a
(Continue reading)


Gmane