🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.mac.oop.powerplant
1 messages
1 total messages Started by Dave Smith Fri, 30 Aug 2002 18:39
[Q] Problem with Resources and 10.2
#19
Author: 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads