🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac.oop.powerplant
Article #19

[Q] Problem with Resources and 10.2

#19
From: Dave Smith
Date: Fri, 30 Aug 2002 18:39
74 lines
3185 bytes
I am having a problem with my application running under MacOSX 10.2. It 
ran fine in 10.1.X, but as soon as I tried running it on 10.2, boom.

Below are the the snippets from the PowerPlant source where the problem 
manifests itself.

Snippets from UTextTraits.cp

....
void
UTextTraits::LoadTextTraits(
   TextTraitsPtr  ioTextTraits)
{
   if (ioTextTraits != nil) {

      switch (ioTextTraits->fontNumber) {

         case fontNumber_Unknown:
            ::GetFNum(ioTextTraits->fontName, &ioTextTraits->fontNumber);
            break;

         case systemFont:
            ioTextTraits->fontNumber = ::GetSysFont();
            break;

         case applFont:
            ioTextTraits->fontNumber = ::GetAppFont();
                    //  ^-- Access fault here
            break;
      }
   }
}


.....


TextTraitsH
UTextTraits::LoadTextTraits(
   ResIDT   inTextTraitsID)
{
   TextTraitsH    traitsH = nil;

   if (inTextTraitsID != Txtr_SystemFont) {

      traitsH = (TextTraitsH)
                     ::GetResource(ResType_TextTraits, inTextTraitsID);
   }

   if (traitsH != nil) {
      StHandleLocker lock((Handle)traitsH);
      LoadTextTraits(*traitsH); // <- goes through here
   }

   return traits2H;
}
.....


The resource in question is valid (tried other resources) and is set as 
purgeable (I don't think this matters).

The problem happens whenever I can the first LoadTextTraits no matter 
which case in the switch statement is used. It seems to me that the 
resource is being set as Read Only and when the handle is written into, 
boom.

Any advice, comments, or pointers would be appreciated.

Please remove no-spam. from email address to email me.

Thanks in advance.
Dave
snorter@rogers.no-spam.com
Technical Details
Message-ID: <snorter-526B4E.14395430082002@nntp.bloor.is.net.cable.rogers.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!news-hog.berkeley.edu!ucberkeley!newshub.sdsu.edu!west.cox.net!cox.net!newsfeeds-atl1.usenetserver.com!newsfeeds-atl2!news.webusenet.com!news03.bloor.is.net.cable.rogers.com!news04.bloor.is.net.cable.rogers.com.POSTED!snorter

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 101ec9,1b04bca598d857f3,start
X-Google-Attributes: gid101ec9,public
X-Google-Thread: 10bcce,1b04bca598d857f3,start
X-Google-Attributes: gid10bcce,public
X-Google-Thread: f635e,1b04bca598d857f3,start
X-Google-Attributes: gidf635e,public
X-Google-Thread: f7f77,1b04bca598d857f3,start
X-Google-Attributes: gidf7f77,public
X-Google-ArrivalTime: 2002-08-30 11:39:55 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!cyclone.bc.net!news-hog.berkeley.edu!ucberkeley!newshub.sdsu.edu!west.cox.net!cox.net!newsfeeds-atl1.usenetserver.com!newsfeeds-atl2!news.webusenet.com!news03.bloor.is.net.cable.rogers.com!news04.bloor.is.net.cable.rogers.com.POSTED!snorter
From: Dave Smith <snorter@rogers.no-spam.com>
Newsgroups: comp.sys.mac.oop.powerplant,comp.sys.mac.programmer.codewarrior,comp.sys.mac.programmer.help,codewarrior.mac
Subject: [Q] Problem with Resources and 10.2
Organization: Persimmon Software
User-Agent: MT-NewsWatcher/3.2 (PPC Mac OS X)
Message-ID: <snorter-526B4E.14395430082002@nntp.bloor.is.net.cable.rogers.com>
Lines: 74
Date: Fri, 30 Aug 2002 18:39:54 GMT
NNTP-Posting-Host: 24.114.40.3
X-Complaints-To: abuse@rogers.com
X-Trace: news04.bloor.is.net.cable.rogers.com 1030732794 24.114.40.3 (Fri, 30 Aug 2002 14:39:54 EDT)
NNTP-Posting-Date: Fri, 30 Aug 2002 14:39:54 EDT