Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!sun-barr!rutgers!cbmvax!ewout From: ewout@topcat.commodore.com (Ewout Walraven) Newsgroups: comp.sys.amiga.programmer Subject: Re: SetFont(rp, &MyFont) eats 24 bytes of fast memory - Found: 2.0 bug Message-ID: <20011@cbmvax.commodore.com> Date: 21 Mar 91 13:38:20 GMT References: <1991Mar20.220218.25195@watdragon.waterloo.edu> <1991Mar21.044941.15171@watdragon.waterloo.edu> Sender: news@cbmvax.commodore.com Organization: Commodore, West Chester, PA Lines: 30 ccplumb@rose.uwaterloo.ca (Colin Plumb) writes: >Well, a bit of poking around in the 2.0 includes discovered the answer. >It's not a message port; it's just that 2.0 usurped the pointer to >point to a TextFontExtension struct. The includes I have say it's >a 20 byte struct, but I'm losing 24... it might have been extended >since I saw it, or those mysterious GfxFree/GfxNew/GfxAssociate functions >I saw doing some bookkeeping for me, but in any case I don't know how to >free it safely. More digging, and aha! There are ExtendFont and >StripFont functions that look significant... >So now my cleanup code, after doing a SetFont() back to the old, saved >rp->Font pointer for paranoia's sake, tests to see if the tf_Extension >(a.k.a. tf_message.mn_ReplyPort) pointer holds non-NULL, and if so, >calls the 2.0-specific StripFont() function on my TextFont structure. >This seems to work, without memory leakage, on both 1.3 and 2.0. >So, I think I've found an (admittedly minor) backward-compatibility bug >between 2.0 and 1.3. Perhaps some 2.0-knowledgeable (or at least, >autodoc-posessing!) person could tell me if this ad hoc solution is >indeed correct? Yes it is. Using SetFont() on in-code TextFonts will loose 24 bytes, unless you call StripFont(). That V36 buglet and how to deal with it are documented in the Autodocs. >Thanks! >-- > -Colin