LeprovostQuentin / mt4j

Automatically exported from code.google.com/p/mt4j
GNU General Public License v2.0
0 stars 0 forks source link

Memory leak in css code #36

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. create new components
2. destroy them
3. check memory usage

Problem probably in getRelevantStyles in CSSStyleManager

public List<CSSStyleHierarchy> getRelevantStyles(MTComponent c) {
        if (!components.contains(c) && c instanceof CSSStylableComponent){ 
            //here exactly
            components.add((CSSStylableComponent)c);
        }

they dont get removed

Original issue reported on code.google.com by sirhc.f...@gmail.com on 23 Jun 2011 at 2:19

GoogleCodeExporter commented 8 years ago
if you add:

/**
 * Unregister component.
 *
 * @param c the c
 */
public void unregisterComponent(CSSStylableComponent c) {
    components.remove(c);
} 

to the CSSStyleManager
and 

@Override
public void destroy() {
    this.mtApp.getCssStyleManager().unregisterComponent(this);
    super.destroy();
}

to the MTCSSStylableShape the problem should be solved

Original comment by incredib...@googlemail.com on 10 Sep 2012 at 8:30