[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Surprising Odds and Ends
David Fanning wrote:
>
> [ far too many words about a routine that one should not use anyway ;-) ]
> [ and then ... ]
> I crashed my widget program in an event handler with
> the info structure checked out with NO_COPY. I stop,
> as I am suppose to, in the event handler module where
> the info structure *is* defined, which has the pointer
> reference inside it.
> [...]
Seems to me as if your problem is related to a somewhat sloppy
distinction
between "global" and "local" information. To my understanding, the
Cleanup routine
only exists to clean up "global" mess, i.e. stuff that can be accessed
via a
well-defined interface (may this be the UValue field of TLB or its
child, or
may these be object fields). From what I leardned from your programs ,
the
info structure which gets parsed by the event handler would instead
contain
a local pointer, i.e. something that has a finite lifetime and was
created specifically
to serve an event. Therefore, the solution should be to free the pointer
within
your event handler routine BEFORE calling the cleanup routine.
In plain words:
CATCH, theError
IF theError NE 0 THEN BEGIN
CATCH, /Cancel
Message,...
IF Ptr_Valid(info.thepointer) THEN Ptr_Free, info.thepointer
Cleanup
ENDIF
If the crash happens in a routine which you never expected to crash,
well then you
apparently caught an oversight by the programmer, and he should be told
to fix the
bug. In this case, a .reset_session usually helps ;-)
Cheers,
Martin
--
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
[[ Dr. Martin Schultz Max-Planck-Institut fuer Meteorologie [[
[[ Bundesstr. 55, 20146 Hamburg [[
[[ phone: +49 40 41173-308 [[
[[ fax: +49 40 41173-298 [[
[[ martin.schultz@dkrz.de [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[