Thanks you John for your valuable comments.

I will refresh my experience with calling Widget.dispose() and its 
effect on children widgets.

26.09.2014 17:07, John Spackman пишет:
> Hi Dimitri
>
> It sounds like you’ve probably read this page but just in case: 
> http://manual.qooxdoo.org/current/pages/development/memory_management.html
>
>> 1. Best place to dispose objects programmatically is the destructor. Is
>> that right?
> Yes
>
>> 2. Are destructors inherently virtual? I've never seen a destructor that
>> calls a base class destructor. Does qooxdoo call base class destructors?
> Yes, destructors all the way up the hierarchy are automatically called, 
> there’s no need for this.base(…)
>
>> 2. References to other objects stored in properties.  Does qooxdoo
>> nullify the properties at disposal?
>>
> Object._disposeObjects (which is qx.util.DisposeUtil) does set properties to 
> null, but the destructor does not nullify property values.
>
>> 3. Extra care should be taken not to dispose the same object more than
>> once. Programmer should keep an eye on references. References can be
>> created directly and indirectly. Direct references are member variables.
>> Indirect references are managed by containers such as Composite, etc.
>> Another case of indirect reference is a parent-child relationship inside
>> complex widgets, I mean "createChildControlImpl”.
> Yes - taking care of only disposing once is a PITA but unavoidable.  As a 
> general rule of good design, each widget should only dispose of it’s own 
> objects and contained objects should be relied upon to dispose of their own 
> objects.
>
>> 3.1. Does a call to dispose automatically remove the reference from the
>> parent container (e.g. Composite)?
> Yes
>
>> 4. References to other objects stored as member variables.  I think that
>> this case is completely up to the programmer. He/she should explicitly
>> dispose objects and then nullify the references. qx.util.DisposeUtil may
>> become handy at that. Instead of disposing a group of objects one by
>> one, one may call qx.util.DisposeUtil.disposeObjects(this,
>> ["foo","bar","etc"]) to dispose them all at once.  It's not that simple
>> however. This method does not fully dispose containers such as
>> Composite, etc. If you are disposing containers then there is a risk of
>> losing references of their children and thus never being able to dispose
>> them.
> It doesn’t?  AIUI calling dispose() on a Widget will dispose all of the 
> contained child widgets recursively
>
>> 4.1. If you want to dispose containers along with their children you can
>> use destroyContainer from qx.util.DisposeUtil.
> Maybe this bit if DisposeUtil is out of date; Widget.destruct calls 
> Widget._disposeChildControls()
>
>> 5. Indirect references to widgets created via "createChildControlImpl".
>> Should I ever dispose them manually? These widgets may easily be
>> Composites with their own children collections. So I definitely should
>> dispose such collections (#4.1).
> Not necessary
>
>> 6. Listeners. Does qooxdoo automatically nullify references to event
>> listeners when their event source gets disposed?
>>
> Yes.
>
> Hope that helps
>
> John
>
>
>
> ------------------------------------------------------------------------------
> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
> http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
> _______________________________________________
> qooxdoo-devel mailing list
> qooxdoo-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
> .
>


------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to