[gs-cvs] rev 8209 - trunk/gs/src

leonardo at ghostscript.com leonardo at ghostscript.com
Mon Aug 27 13:44:28 PDT 2007


Author: leonardo
Date: 2007-08-27 13:44:27 -0700 (Mon, 27 Aug 2007)
New Revision: 8209

Modified:
   trunk/gs/src/gxccman.c
   trunk/gs/src/gxttfb.c
Log:
Fix (TT font handler) : Place the True Type interpreter and its data into stable memory.

DETAILS :

Bug 688429 "Crash on vmreclaim".

With the old code gx_ttfReader and ttfInterpreter instances
were prematurely released by 'restore' while 
gs_font_dir and cached_fm_pair instances contain
references to them. Since TT interpreter is a global singleton,
we're safe to store it in stable memory.

EXPECTED DIFFERENCES :

None.


Modified: trunk/gs/src/gxccman.c
===================================================================
--- trunk/gs/src/gxccman.c	2007-08-27 01:16:47 UTC (rev 8208)
+++ trunk/gs/src/gxccman.c	2007-08-27 20:44:27 UTC (rev 8209)
@@ -230,7 +230,7 @@
     m.yx = cyx;
     m.yy = cyy;
     m.tx = m.ty = 0;
-    pair->ttr = gx_ttfReader__create(dir->memory);
+    pair->ttr = gx_ttfReader__create(dir->memory->stable_memory);
     if (!pair->ttr)
 	return_error(gs_error_VMerror);
     /*  We could use a single the reader instance for all fonts ... */

Modified: trunk/gs/src/gxttfb.c
===================================================================
--- trunk/gs/src/gxttfb.c	2007-08-27 01:16:47 UTC (rev 8208)
+++ trunk/gs/src/gxttfb.c	2007-08-27 20:44:27 UTC (rev 8209)
@@ -368,7 +368,7 @@
 
 ttfFont *ttfFont__create(gs_font_dir *dir)
 {
-    gs_memory_t *mem = dir->memory;
+    gs_memory_t *mem = dir->memory->stable_memory;
     ttfFont *ttf;
 
     if (dir->ttm == NULL) {
@@ -384,7 +384,7 @@
     }
     if(ttfInterpreter__obtain(&dir->ttm->super, &dir->tti))
 	return 0;
-    if(gx_san__obtain(mem->stable_memory, &dir->san))
+    if(gx_san__obtain(mem, &dir->san))
 	return 0;
     ttf = gs_alloc_struct(mem, ttfFont, &st_ttfFont, "ttfFont__create");
     if (ttf == NULL)
@@ -395,16 +395,15 @@
 
 void ttfFont__destroy(ttfFont *this, gs_font_dir *dir)
 {   
-    ttfMemory *mem = this->tti->ttf_memory;
+    gs_memory_t *mem = dir->memory->stable_memory;
 
-    /* assert(mem == &dir->ttm->super); */
     ttfFont__finit(this);
-    mem->free(mem, this, "ttfFont__destroy");
+    gs_free_object(mem, this, "ttfFont__destroy");
     ttfInterpreter__release(&dir->tti);
     gx_san__release(&dir->san);
     if (dir->tti == NULL && dir->ttm != NULL) {
 	dir->ttm = NULL;
-	mem->free(mem, mem, "ttfFont__destroy(gx_ttfMemory)");
+	gs_free_object(dir->memory, mem, "ttfFont__destroy(gx_ttfMemory)");
     }
 }
 



More information about the gs-cvs mailing list