Hi,

Try to use the "MemHandleUnlock" in the last row (after indexLst++; ).

- Martin.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Chris Engler
Sent: Friday, May 27, 2005 11:35 AM
To: Palm Developer Forum
Subject: "unlocked chunk of memory" error


I am using the code below to create a list.  However it keeps giving me an 
"unlocked chunk of memory" error.  I have tried several different 
arrangements using StrCopy and MemMove but I continue to get this error.  I 
must be overlooking something.  Please, someone offer me some suggestions. 
Thank you!

Char ** gPackList = 0;
Char packBuffer[21] = "";
Boolean addToList = true;

some code...

case frmOpenEvent:
    gPackList = (Char **) MemPtrNew(packListSize * sizeof(Char*));

some code...

if (addToList)
{
            UInt32 len = StrLen(packBuffer);
            MemHandle packH = MemHandleNew(len + 1);
            Char* packP = (Char*)MemHandleLock(packH);
            MemMove(packP, packBuffer, len + 1);
            MemHandleUnlock(packH);
            packH = 0;
            gPackList[indexLst] = (Char*)packP;
            indexLst++;
}

some code...

Best Regards,

Chris Engler 



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

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

Reply via email to