Hello!

I have my Data Form in my application and in this form
I initialize List resource in DataFormInit function:

gStringsHandle=DmGetResource('tSTL', ZonesStringList);
if(gStringsHandle)
 {
  StrListPtr stringsPtr;

  listP=FrmGetObjectPtr(frmP, FrmGetObjectIndex(frmP,
DataUnnamed1118List));
  stringsPtr=MemHandleLock(gStringsHandle);
              
             
gStringArrayH=SysFormPointerArrayToStrings(stringsPtr->firstString,stringsPtr->numStrings);
             
LstSetListChoices(listP,MemHandleLock(gStringArrayH),stringsPtr->numStrings);

          if (gStringsHandle)
MemHandleUnlock(gStringsHandle);
              if (gStringsHandle)
DmReleaseResource(gStringsHandle);
           }

where StrListPtr is

typedef struct StrListType{
        char prefixString;
        char numStringsHiByte;
        char numStrings;
        char firstString[1];
}*StrListPtr;

You can see that I unlock and release gStringsHandle,
but gStringArrayH is still unlocked. When I unlock
gStringArrayH in DataInitForm, my List didn't work and
I unlock it in DataFormHandleEvent() like this

        case frmCloseEvent:
                if (gStringArrayH)
MemHandleUnlock(gStringArrayH);
                        gStringArrayH=NULL;
                        break;

But this implementation requires declaration of
gStringArrayH as a global variable and it is very bad
for memory. 

How can I do it (unlock) right??

Thanks,
Sergei


__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to