Yeah, I see. That makes sense.

For now, just set your fsm variable to null. This doesn't help you if
you're trying to use the dispose debugging, but at least should ensure that
the memory does actually get garbage collected. At some point, I may try to
work out how to allow the dispose debugging to work with this, but it's a
pretty obscure case and is becoming less and less necessary as browsers
mature anyway.

Cheers,

Derrell


On Wed, Mar 9, 2016 at 1:00 PM voger <vogernewslett...@yahoo.gr> wrote:

> I did this and the result is that the "terminated" event is not even
> handled. I get this debug line:
>
> 005436 qx.util.fsm.FiniteStateMachine[52-0]: Fsm_1: Cannot listen to
> event 'terminated', because the finite state machine is not running.
>
>
>
> On 08/03/2016 11:42 μμ, Derrell Lipman wrote:
> > So I've been thinking about this. Although what I told you is correct --
> > modern browsers, and even old ones, should have no problem automatically
> > garbage collecting an FSM because it has no references to DOM objects
> > and no circular references -- qooxdoo debug display logic could still be
> > applied to disposal. I'm thinking about what needs to change to support
> > that feature.
> >
> > Would you please try something for me...
> >
> > At qx/util/fsm/FiniteStateMachine.js:1236, change
> >    this.fireDataEvent("terminated", thisState)
> > to
> >    this.scheduleEvent("terminated", this, thisState);
> >
> > Then run your original playground test with your call to fsm.dispose().
> > I'm interested in whether you still see the crash. I don't think you
> > will, since the fsm processing stack will have unwound at the point that
> > the event fires so it should be safe to dispose.
> >
> > (BTW, after calling fsm.dispose(), you should probably /still/ be
> > setting your fsm variable to null, so that the garbage collector can do
> > its job on the FSM object itself.)
> >
> > Derrell
> >
> >
> > On Tue, Mar 8, 2016 at 3:33 PM voger <vogernewslett...@yahoo.gr
> > <mailto:vogernewslett...@yahoo.gr>> wrote:
> >
> >     Thanks Derrell. It is great to hear from the author itself.
> >
> >     It's just that I saw in the qx.util.fsm.FiniteStateMachine#destruct()
> >     code that it does some clean up functionality and wanted to be in the
> >     safe side.
> >
> >     Plus if I wouldn't understand why it didn't work how I thought it
> >     should, I would literally loose sleep over it. I don't exaggerate. I
> >     wasted hours to understand the problem even after you suggested that
> >     there was no need to dispose the fsm.
> >
> >
> >
> >
> >
> >     On 08/03/2016 07:03 μμ, Derrell Lipman wrote:
> >      > Right. My suggestion is that you shouldn't need to call
> >     fsm.dispose().
> >      > Instead, just set
> >      >     fsm = null;
> >      > so it will be garbage collected. I don't believe there is
> >     anything here
> >      > that needs "help" with disposing.
> >      >
> >      > Here's the modified example: http://tinyurl.com/zxmbrcj
> >      >
> >      > Cheers,
> >      >
> >      > Derrell
> >      >
> >      >
> >      > On Tue, Mar 8, 2016 at 11:20 AM voger <vogernewslett...@yahoo.gr
> >     <mailto:vogernewslett...@yahoo.gr>
> >      > <mailto:vogernewslett...@yahoo.gr
> >     <mailto:vogernewslett...@yahoo.gr>>> wrote:
> >      >
> >      >     I did a simple example of the problem.
> http://tinyurl.com/zg8nse2
> >      >
> >      >     After some investigation with the debugger it seems that the
> >     problem is
> >      >     the fact that I am trying to dispose the fsm object using
> >     it's own event
> >      >     handler.
> >      >
> >      >     A walk through to explain better what I mean:
> >      >
> >      >     1. In the final state I click the "Terminate" button.
> >      >     2. The fsm object picks the "execute" event and starts
> >     processing it
> >      >     3. One of the handlers decides to fsm.dispose()
> >      >     4. The fsm isn't done yet with the "execute" event but the
> >     fsm it's
> >      >     gone now
> >      >     5. Exception
> >      >
> >      >
> >      >     An idea how to terminate and dispose the fsm is to use some
> >     other event
> >      >     not observed by fsm. Something like this example
> >      > http://tinyurl.com/jj7kfxt .
> >      >
> >      >
> >      >
> >      >
> >      >
> >      >
> >      >
> >      >
> >
>  
> ------------------------------------------------------------------------------
> >      >     Transform Data into Opportunity.
> >      >     Accelerate data analysis in your applications with
> >      >     Intel Data Analytics Acceleration Library.
> >      >     Click to learn more.
> >      > http://makebettercode.com/inteldaal-eval
> >      >     _______________________________________________
> >      >     qooxdoo-devel mailing list
> >      > qooxdoo-devel@lists.sourceforge.net
> >     <mailto:qooxdoo-devel@lists.sourceforge.net>
> >      >     <mailto:qooxdoo-devel@lists.sourceforge.net
> >     <mailto:qooxdoo-devel@lists.sourceforge.net>>
> >      > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> >      >
> >      >
> >      >
> >      >
> >
>  
> ------------------------------------------------------------------------------
> >      > Transform Data into Opportunity.
> >      > Accelerate data analysis in your applications with
> >      > Intel Data Analytics Acceleration Library.
> >      > Click to learn more.
> >      > http://makebettercode.com/inteldaal-eval
> >      >
> >      >
> >      >
> >      > _______________________________________________
> >      > qooxdoo-devel mailing list
> >      > qooxdoo-devel@lists.sourceforge.net
> >     <mailto:qooxdoo-devel@lists.sourceforge.net>
> >      > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> >      >
> >
> >
> >
>  
> ------------------------------------------------------------------------------
> >     Transform Data into Opportunity.
> >     Accelerate data analysis in your applications with
> >     Intel Data Analytics Acceleration Library.
> >     Click to learn more.
> >     http://makebettercode.com/inteldaal-eval
> >     _______________________________________________
> >     qooxdoo-devel mailing list
> >     qooxdoo-devel@lists.sourceforge.net
> >     <mailto:qooxdoo-devel@lists.sourceforge.net>
> >     https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > Transform Data into Opportunity.
> > Accelerate data analysis in your applications with
> > Intel Data Analytics Acceleration Library.
> > Click to learn more.
> > http://makebettercode.com/inteldaal-eval
> >
> >
> >
> > _______________________________________________
> > qooxdoo-devel mailing list
> > qooxdoo-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> >
>
>
>
> ------------------------------------------------------------------------------
> Transform Data into Opportunity.
> Accelerate data analysis in your applications with
> Intel Data Analytics Acceleration Library.
> Click to learn more.
> http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
> _______________________________________________
> qooxdoo-devel mailing list
> qooxdoo-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to