freetype-devel
[Top][All Lists]
Advanced

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

FT2: Error in FT_Done_Library()?


From: Jack Davis
Subject: FT2: Error in FT_Done_Library()?
Date: Fri, 18 Feb 2000 11:39:08 -0800

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

Attachment: ft2test1.cpp
Description: Text document


reply via email to

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