comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Surprising Odds and Ends
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Surprising Odds and Ends [message #21231 is a reply to message #21228] Tue, 15 August 2000 00:00 Go to previous messageGo to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Martin Schultz (martin.schultz@dkrz.de) writes:

> 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

Well, in plain words, this is right, although you can't
(well, "shouldn't" is a more accurate word) call the
Cleanup procedure yourself. The Cleanup procedure is
called when the widget associated with it dies. The
CATCH would more likely look like this:

CATCH, theError
IF theError NE 0 THEN BEGIN
CATCH, /Cancel
Message,...
IF N_Elements(info) NE 0 THEN $
Widget_control, event.top, Set_UValue=info, /No_Copy
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 ;-)

I'm a big fan of .Reset_Session, but I still see far too
many people in my travels who exit IDL every time they
crash a widget program because they have never heard of
RETALL and they can't ever get a widget program running
after one crashes! Getting those folks hooked on .Reset
would be just as bad. :-(

My problem is that I'm trying to tell a story in
some logical order and the denouement doesn't happen
until the hero gets burned almost beyond recognition
by asking for user input to read a file. Error Handling
is a nurse who brings him back to life and gives him
reason to live again. But I'm several chapters away
from all of that.

Cheers,

David

P.S. Let's just say the working title of my new book
is The IDL Patient. Catchy, don't you think. :-)
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Throwing Widget Events?
Next Topic: Throwing Widget Events?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 14:52:48 PDT 2025

Total time taken to generate the page: 0.40276 seconds