My question is: is the application corrent:
http://tinyurl.com/oju4mtc <http://tinyurl.com/oju4mtc>  
 (full code below)
 
Specifically, is the construction and disposal of the _actions array
correct? I suppose it is reasonable to destruct Commands in the menu
destructor if i'm sure that they are referenced only from the menu. Are
there errors in my reasoning? 

This code gives an error when built with qx.debug.dispose.level = 2 (Qooxdoo
version 3.0.1), and if it's conceptually correct, it seems there exists a
bug(s) in Qooxdoo that prevents the desposer-debug tool to do its work
properly. I'll provide other necessary information on the problem if needed.

==================
// Full code:

qx.Class.define("app.Menu", {
        extend: qx.ui.menu.Menu,
  
        construct: function() {
                this.base(arguments);
                
                this._actions = [];
        },
        
        destruct: function() {
                qx.log.Logger.debug("~Menu()");
                this._disposeArray("_actions");
        },

        members: {              
                _actions: null,
                
                createAction: function(label) {
                        var action = new qx.ui.core.Command();
                        this._actions.push(action);
                        var menuButton = new qx.ui.menu.Button(label, null, 
action);
                        this.add(menuButton);
                        return action;
                }
        }

});

qx.Class.define("app.Application", {
        extend : qx.application.Standalone,

        members : {

                main : function() {
                        this.base(arguments);
                        
                        var menu = new app.Menu();
                        menu.createAction('action-1');
                        menu.createAction('action-2');
      
                        var root = this.getRoot();
                        var button = new qx.ui.form.Button("Dispose menu");
                        root.setContextMenu(menu);
                        button.addListener("execute", function() {
                                root.setContextMenu(null);
                                menu.dispose();
                        });
                        
                        this.getRoot().add(button);      
                }
        }
});




--
View this message in context: 
http://qooxdoo.678.n2.nabble.com/Disposing-Commands-in-menu-destructor-tp7585184.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to