From: "Agus Silas" <[EMAIL PROTECTED]>
> In fact, I've moved the free session from the end of the AppEventLoop to
> AppStop. I thougt that I "cut" then "paste", but instead I "copy" then
> "paste", so I freed twice.
> 
A good way to avoid this error, or at least prevent it 
causing problems is to set every pointer to null immediately
after freeing it (I used to use a macro that did both steps so
that it was impossible to forget).  You can then test pointers
for null before freeing them, preventing double-frees (some
platforms will ignore a free of null, making the test redundant, 
but some won't so I tend to check to be on the safe side - not 
sure about Palm OS).

Of course it's not a replacement for careful coding, but it's nice 
to have procedures that produce robust code even if it's 3:00am
and you haven't slept in two days.  :-)

Chris Tutty

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

Reply via email to