[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FIXED - FT2: Error in FT_Done_Library()?
From: |
David Turner |
Subject: |
FIXED - FT2: Error in FT_Done_Library()? |
Date: |
Mon, 21 Feb 2000 16:21:31 +0100 |
Hello Jack,
Thanks a lot for reporting this error. Actually, I wasn't aware of this problem,
and it wasn't the reason for not calling FT_Done_FreeType in "ftview" (the bug
was introduced with the latest change of the TrueType glyph loader, which is way
more recent :-)
I have found the bug and commited the fix to the CVS repository. It involved
modifying several files because I partially re-designed a few things in the
way.
I have also added a new demo program called "demos/src/memtest.c" which is
derived from the one you sent us. Basically, it shows how to hook a custom
memory manager to the FreeType library. (Note that it is not compiled by
defaulted, simply because it includes hard-coded font paths that I don't
want in the "clean" demos).
Note that the functions "FT_New_Library" and "FT_Default_Drivers" are not
public yet though, but it gives a pretty good idea on how to do it..
Again, thanks
- David
Jack Davis a écrit :
>
> Hi David/Werner,
>
> I am getting a Windows system error when FT_Done_Library() apparently tries
> to free an invalid memory block. I've reduced my test to a 7 line
> program that produces the error if FT_Load_Glyph() is called (see below, a
> file copy also attached).
>
> I noticed that the demo\ftview.c sample program does not call FT_Done_Library
> (?! - only TF_Done_Face() is called). Is this a problem you are aware
> of? For this test I'm compiling as a console app using Visual C++ v6 and
> building my FT2 library from sources downloaded on 2/17. Has anyone else
> using Visual C experienced this problem?
>
> Thanks,
> Jack
>
> In stepping through the program, all FT2 functions return with 0 until the
> memory exception in FT_Done_Library() is encountered. If the call to
> FT_Load_Glyph() is commented out, everything runs properly and even
> FT_Done_Library() returns with a normal 0 result.
>
> /* ft2test1.cpp */
>
> #include "stdafx.h"
> #include <freetype.h>
>
> int APIENTRY WinMain(HINSTANCE hInstance,
> HINSTANCE hPrevInstance,
> LPSTR lpCmdLine,
> int nCmdShow)
> {
> FT_Library library;
> FT_Face face;
> int glyphIndex;
> int result;
>
> result = FT_Init_FreeType( &library );
>
> result = FT_New_Face( library, "arial.ttf", 0, &face );
>
> result = FT_Set_Char_Size( face, 0, 16*64, 96, 96 );
>
> glyphIndex = FT_Get_Char_Index( face, (int)'A' );
>
> /* memory error occurs in FT_DoneFreeType() if FT_Load_Glyph() is called
> */
> result = FT_Load_Glyph(face, glyphIndex, FT_LOAD_DEFAULT );
>
> result = FT_Done_Face( face );
>
> result = FT_Done_FreeType( library );
>
> return 0;
> }
>
> The call stack sequence when the error occurs appears as follows:
>
> free(void * 0x007a5090) line 926 + 11 bytes
> ft_free(FT_MemoryRec_ * 0x007a03d0, void * 0x007a5090) line 143 + 9 bytes
> FT_Free(FT_MemoryRec_ * 0x007a03d0, void * * 0x007a45d0) line 206 + 18 bytes
> TT_Done_GlyphZone(FT_MemoryRec_ * 0x007a03d0, TT_GlyphZone_ * 0x007a45c0)
> line 109 + 16 bytes
> TT_Destroy_Context(TT_ExecContextRec_ * 0x007a4560, FT_MemoryRec_ *
> 0x007a03d0) line 386 + 19 bytes
> TT_Done_Driver(TT_DriverRec_ * 0x007a0170) line 931 + 22 bytes
> Destroy_Driver(FT_DriverRec_ * 0x007a0170) line 376 + 12 bytes
> FT_Done_Library(FT_LibraryRec_ * 0x007a02e0) line 721 + 9 bytes
> FT_Done_FreeType(FT_LibraryRec_ * 0x007a02e0) line 2509 + 9 bytes
>
> ft2test1.cppName: ft2test1.cpp
> Type: Plain Text (text/plain)