From: Marko Luukkainen Date: Thu, 9 Dec 2021 17:26:24 +0000 (+0200) Subject: JFreeChart implementation is leaking memory X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=48c79b6a75572f8ca14f991be8ddac91a2286c8a;p=simantics%2Fsysdyn.git JFreeChart implementation is leaking memory Take account that new PlotProperties may contain the same objects as the old one. gitlab #86 --- diff --git a/bundles/org.simantics.jfreechart/src/org/simantics/jfreechart/chart/AbstractPlot.java b/bundles/org.simantics.jfreechart/src/org/simantics/jfreechart/chart/AbstractPlot.java index 2d5daec8..5f7c15ef 100644 --- a/bundles/org.simantics.jfreechart/src/org/simantics/jfreechart/chart/AbstractPlot.java +++ b/bundles/org.simantics.jfreechart/src/org/simantics/jfreechart/chart/AbstractPlot.java @@ -91,13 +91,16 @@ public abstract class AbstractPlot implements IPlot { protected void setPlotProperties(PlotProperties properties) { if (currentProperties != null) { for (IAxis axis : currentProperties.ranges) - axis.dispose(); + if (!properties.ranges.contains(axis)) + axis.dispose(); for (IAxis axis : currentProperties.domains) - axis.dispose(); + if (!properties.domains.contains(axis)) + axis.dispose(); for (IDataset dataset : currentProperties.datasets) - dataset.dispose(); + if (!properties.datasets.contains(dataset)) + dataset.dispose(); } this.currentProperties = properties; }