Question on closing SingleCDockables

Is there any reason that SingleCDockables do not remove themselves from the CControl when the CloseAction is triggered? Right now close just calls setVisible(false). Over time this could lead to running out of memory.

MultipleCDockables have a setRemoveOnClose() flag that can be set for cleanup, adding that flag SingleCDockables probably makes sense.

Here is the logic I’m using the cleanup closed SingleCDockables

        // when the CDockable is made not visible, remove it from the CControl  
        control.addStateListener(new CDockableAdapter(){
            @Override
            public void visibilityChanged(CDockable dockable) {
                if (!dockable.isVisible() && dockable instanceof SingleCDockable){
                    control.remove((SingleCDockable) dockable);
                }
            }
        });

The main reason is that the user may want to re-open a SingleCDockable. Removing it from the CControl would mean all location information is lost.

I agree that the “removeOnClose” flag could probably be useful for (some) SingleCDockables as well. I’ll add it.

Thanks Beni!