At 5:08 PM -0400 4/21/06, Alexander Bauza wrote:

- InfoWindow calls ProgressWindow passing InfoWindow by reference
- ProgressWindow calls ThreadA passing ProgressWindow  by reference
- ThreadA calls ThreadB passing ProgressWindow  by reference
- ThreadB calls ThreadC passing ProgressWindow  by reference
- ThreadC calls ThreadD passing ProgressWindow  by reference
- ThreadD must close ProgressWindow and InfoWindow

I hope all those "by reference" words don't mean that you're actually passing object references ByRef. There is pretty much never any point in doing that. My first suggestion is to remove the ByRef keyword from all those methods.

In the last step:

a) if I close ProgressWindow I lose the reference to InfoWindow... I can't close... my app crashes (and the debug doesn't handle it)

Hmm, I wouldn't expect a crash, but it's possible it's confused by the ByRef, which would let you do nasty things like set the caller's reference to nil.

Anyway, here's how I would do it: add a CleanUp method on ProgressWindow. This should tell its InfoWindow to close, and then set its InfoWindow reference to nil. It should then close itself. ThreadD then needs only to call CleanUp on its ProgressWindow reference (and then set that reference to nil).

The "set the reference to nil" steps are just to make sure you don't hang on to a reference to an already-closed window.

HTH,
- Joe

--

Joe Strout  --  [EMAIL PROTECTED]
Available for custom REALbasic programming and training.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to