freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FT_FACE_FLAG_EXTERNAL_STREAM -> memory leak ???


From: Just van Rossum
Subject: Re: FT_FACE_FLAG_EXTERNAL_STREAM -> memory leak ???
Date: Thu, 27 Jul 2000 20:07:43 +0100

At 7:44 PM +0200 27-07-2000, David Turner wrote:
>Actually, "ft_init_stream" has been modified.

Sorry, I missed that...

>When an external stream
>is used, no new "stream" object is created (instead, face->stream points
>to the custom stream directly).

Ah; that's an important change; I need to update my code...

>so what happens is the following on ft_done_stream:
>
>  - always close the stream
>  - free the stream object it isn't external

Right. However, I don't understand why it always closes the stream: that
should be up to the caller, too, no? (As it was before.)

Another problem: In the new Mac support (src/base/ftmac.c), I create an
external stream, but I *still* want FT to clean it up. But I can only reset
the FT_FACE_FLAG_EXTERNAL_STREAM flag after FT_Open_Face() has succeeded,
so I'll have to clean it up myself if it fails... Ugly:

    [ stream creation code snipped ]
    args.flags = ft_open_stream;
    args.stream = stream;
    error = FT_Open_Face( library, &args, face_index, aface );
    if ( error == FT_Err_Ok )
      (*aface)->face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM;
    else
    {
      FT_Done_Stream( stream );
      FREE( stream );
    }
    return error;

It would be nicer if there was a flag in args.flags I could set to specify
that even though *I* created the stream, I want the face to finalize it,
ie. to treat it as internal.

More nits: The FT_Stream object really needs a cleaner API. These two
things I really missed:
- there is no public API to conveniently create & initialize streams (the
calls that are there still require you to "manually" allocate space for the
stream object itself)
- there is no public API that destroys *and* closes the stream

Just





reply via email to

[Prev in Thread] Current Thread [Next in Thread]