freetype
[Top][All Lists]
Advanced

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

[ft] Assertion fails when calling FT_Open_Face, caused by custom stream


From: Timon Christl
Subject: [ft] Assertion fails when calling FT_Open_Face, caused by custom stream
Date: Thu, 25 Aug 2005 04:40:06 +0200

Hi!

I'm using freetype 2.1.10. While wiring freetype into my program I
found that Freetype stops at an assertion when calling FT_Open_Face.
The actual place is elsewhere, in ftstream.c, line 231
(FT_Stream_EnterFrame):

    FT_ASSERT( stream && stream->cursor == 0 );

When I inspect "stream" in the debugger, it has the value 0xcccccccc,
which is the default value that the debugger in MS Visual Studio .NET
writes to uninitialized memory. The code is obviously expecting 0
here.

I guess that this happens because I'm passing my own stream struct to
FT_Open_Face, which causes the code in ftobjs.c, line 147ff
(FT_Stream_New)

    else if ( ( args->flags & FT_OPEN_STREAM ) && args->stream )
    {
      /* use an existing, user-provided stream */

      /* in this case, we do not need to allocate a new stream object */
      /* since the caller is responsible for closing it himself       */
      FT_FREE( stream );
      stream = args->stream;
    }

to copy my stream over the temporary stream that was created in that
function. When inspecting that stream I found its cursor was 0. I
seems that Freetype zeroes out all structures it allocates, and
silently assumes that the user of the library zeroes out all
structures after allocation as well. This would be OK if it is
documented, but it isn't.

So, is my assumption correct, should I zero all memory that I pass to freetype?

-- 
(defun f(p x)(If(Eq x nil)nil(If(p(Car x))(Cons(Car x)(f p(Cdr x)))(f p
(Cdr x)))))(defun q(x)(Q nil x))(defun Q(a x)(If(Eq x nil)a(Q(Cons(Car
x)(Q a(f(Lt(Car x))(Cdr x))))(f(Gt(Car x))(Cdr x)))))




reply via email to

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