]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Store the data pointer and free it on Font_UnloadFont
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 12 Nov 2010 18:40:47 +0000 (18:40 +0000)
committerRudolf Polzer <divverent@alientrap.org>
Fri, 12 Nov 2010 18:51:04 +0000 (19:51 +0100)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10588 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=179be6fd1f715bac570e73aa9cadb0e08d0f7979

ft2.c
ft2.h

diff --git a/ft2.c b/ft2.c
index f395e39ba6c7c5ad6a2847f16b896ff625541de9..a236348a6a142371baaaeaecc0c7c0bf38b8a08f 100644 (file)
--- a/ft2.c
+++ b/ft2.c
@@ -510,6 +510,7 @@ static qboolean Font_LoadFile(const char *name, int _face, ft2_settings_t *setti
                _face = 0;
                status = qFT_New_Memory_Face(font_ft2lib, (FT_Bytes)data, datasize, 0, (FT_Face*)&font->face);
        }
+       font->data = data;
        if (status)
        {
                Con_Printf("ERROR: can't create face for %s\n"
@@ -981,6 +982,10 @@ void Font_UnloadFont(ft2_font_t *font)
                        font->face = NULL;
                }
        }
+       if (font->data) {
+           Mem_Free(font->data);
+           font->data = NULL;
+       }
 }
 
 static float Font_SearchSize(ft2_font_t *font, FT_Face fontface, float size)
diff --git a/ft2.h b/ft2.h
index b8d8cd5c87f192da0d9c35dc0de2330d79bca66c..78728c2dfd18778a164728f400578c32d1275693 100644 (file)
--- a/ft2.h
+++ b/ft2.h
@@ -43,7 +43,7 @@ typedef struct ft2_font_s
 
        // TODO: clean this up and do not expose everything.
        
-       //unsigned char  *data;
+       unsigned char  *data; // TODO: See if FT2 actually needs it to stay... probably does
        //fs_offset_t     datasize;
        void           *face;