Re: pfdLoadFont problem

New Message Reply Date view Thread view Subject view Author view

Don Hatch (hatch++at++hell.engr.sgi.com)
Mon, 29 Sep 1997 15:12:57 -0700


On Sep 29, 12:34pm, Jean-Luc Dery wrote:
> Subject: pfdLoadFont problem
> Hi folks,
>
> I have a little problem with the font loader.
>
> Our application uses the font type 1 developped by M. Haeberli and loads them
> using the pfdLoadFont_type1 utility.
>
> The application can load/unload scenes during a single work session, meaning
> that we load a scene and some time later, destroy it and reload another one.
> When loading a given scene, fonts are loaded with pfdLoadFont_type1 and
> referenced multiple times if more than one pfString object uses it. When
> unloading a scene, all the scene tree is destroyed except the pfScene root
> node, to which the next loaded scene is attached. Up to know, nothing special.
>
> But what happens is when a font is used in a scene, destroyed and then reloaded
> in a newly loaded scene, the application crashes in pfdLoadFont_type1 function
> call. This might not happen at the first reload of the font, but always happens
> after a few reloads (sometimes after one and usually less than 5). If we work
> with the same databases but don't load fonts, everything works fine. So my way
> of handling pfFont/pfString/pfText is wrong or the way pfdLoadFont works not
> optimal. By the way, I'm not using the pfBuffer's for now, until I debug this;
> so every memory allocation/deallocation is done in the app process using pf/pr
> new operators and pfDelete.
>
> The application is built with Performer 2.1 and the problem occurs on different
> platforms with different operating systems (6.2/6.3/6.4).
>
> Help, ...
>
> And thanks in advance for your suggestions.
>
> Jean-Luc.

I've run into a similar problem: if an application calls
pfdLoadFont_type1(), then creates and deletes a string with the font,
and then calls pfdLoadFont_type1(), it accesses freed memory
and core dumps.
As a workaround, I add an extra ref to whatever pfdLoadFont_type1() returns
(of course, now there's probably a memory leak instead of a core dump):
        fnt = pfdLoadFont_type1(...);
        pfRef(fnt); /* add this line to work around Performer bug */

Let me know if this workaround works for you.
I'll be trying to track down and fix this bug sometime in the next
couple of weeks.
If you want, you can find and try to fix it yourself,
since you have the source...
if you do, please let me know what the fix is
so we can fix it in the upcoming Performer releases.

Thanks!
Don

-- 
Don Hatch  hatch++at++sgi.com  (415) 933-5150  Silicon Graphics, Inc.
=======================================================================
List Archives, FAQ, FTP:  http://www.sgi.com/Technology/Performer/
            Submissions:  info-performer++at++sgi.com
        Admin. requests:  info-performer-request++at++sgi.com

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:56:01 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.