At 10:48 +1200 24/09/01, Sean Wilson wrote:
>Jakob, you may recognise the following. It is what started me on the MIAW
>closing approach using timeouts. It doesn't work without modification - at
>least not with D8/8.5, win2K. This is the same problem that Fumio described
>at the start of this thread. What I subsequently posted was the "fix" that
>worked for me, as described below. Your code will close the window the
>*first* time, but then won't allow you to re-open the same window. "Unable
>to open file whatever.dir because it is already open with write permission
>... "
>
>> In the Miaw have these 2 scripts:
>> (requires D8)
>>
>> --------<movie script>--------
>> on closeWindow
>> script("miawCloserClass").new(the activeWindow)
>> end
>> --------</movie script>--------
>>
>> --------<parent script "miawCloserClass">--------
>> --miawCloserClass
>>
>> property pWindow
>>
>> on new me, aWindow
>> pWindow = aWindow
>> tell the stage to timeOut(me.string).new(0, #dummy , me)
>> end
>>
>> on exitFrame me, aTimer
>> aTimer.forget()
>> pWindow.forget()
>> end
>> --------</parent script "miawCloserClass">--------
>>
>> That should rid you completely of the Miaw... unless you have stored
>> references to the Miaw.
>
>Reason: the exitFrame handler of the child object doesn't void the timeout,
>thus a mutual reference is maintained between this child and the timeout.
No, there are no mutual references.
-The timeoutList refers to the timeoutObject
-The timeoutObject refers to the scriptInstance
-The scriptInstance refers to the miaw
That's all.
>But now, the timeout is gone from the timeoutlist, so stops sending playback
>events to the child, and there is no way back to either of these objects.
>They persist in RAM with no other pointers to them.
Yes, they persist in RAM, but *not* because of mutual references.
>I would further suggest that adding pWindow.forget() to the miawCloserClass'
>"new" handler merely defers the problem. The window will close properly and
>re-open, but you now have a mutual reference that doesn't also contain a
>reference to the MIAW, which is what allowed me to identify the problem in
>the first place.
>
>The point of this discussion, for me at least, has been to suggest that when
>a timeout is forgotten, it also needs to have its reference voided, or its
>target voided.
Only if the timeoutObject for "other reasons" persists.
>Modifying the exitFrame handler as follows
>
>on exitFrame me, aTimer
> aTimer.forget()
> aTimer = VOID -- or 0
> pWindow.forget()
>end
I guess that this is a typo? aTimer is a local variable, that will be
cleared when the handler goes out of scope, clearing it shouldn't
accomplish anything, and it doesn't help in my test.
Did you mean: aTimer.target = VOID?
>is all that is required to both allow the window that is closed/forgotten to
>be re-opened, but also ensure that mutual references are destroyed.
There are no mutual references.
>If you can't verify this yourself, I am more than happy to send you example
>files off-list that demonstrate what I'm describing.
I can indeed verify that there is a problem with my code, but it's
not for the reasons you think.
I stipulate this point, because I want to stress that my code wasn't
flawed by design, sloppy or the result of malpractice.
I will explain the "problem" in another mail.
jakob
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]