At 04:15 AM 4/29/2007, you wrote:
Subject: re: Falta Alert only on Z22!
From: "Marina Ma" <[EMAIL PROTECTED]>
Date: Sat, 28 Apr 2007 08:13:26 -0000
X-Message-Number: 1

Hi, all friends:

I'm tracing the position, and found it will show the alert when running such code:
for (i = 0; i < IGame->game_actors.size(); i++)
{
    delete IGame->game_actors[i];
}

And as I said before, I have overriden the delete operator in order to use the Palm self delete function:
inline void operator delete(void *ptr)
{
    if (ptr) MemPtrFree(ptr);
}

Do you have any idea with the reason?


It is possible, I suppose, one of the pointers is getting corrupted, and then you freeing a corrupted pointer.

Then the question becomes, apart from your check against NULL, how to ensure the pointer is valid before you through it at MemPtrFree() ?
You could try (though I never have)

for (i = 0; i < IGame->game_actors.size(); i++)  {
        if (NULL != IGame->game_actors[i]  &&
                        memIDPtr == MemLocalIDKind(IGame->game_actors[i]))
                delete IGame->game_actors[i];
        IGame->game_actors[i] = NULL;  // prevent duplicate 'free'
}


Roger Stringer
Marietta Systems, Inc. (www.rf-tp.com)


--
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to