]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
We must use adaptUnique for getting chart object from DB. release/1.35.3
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Mon, 24 Jan 2022 15:00:02 +0000 (17:00 +0200)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Mon, 24 Jan 2022 15:00:02 +0000 (17:00 +0200)
Otherwise, DB may return disposed chart.

gitlab #86

bundles/org.simantics.jfreechart/src/org/simantics/jfreechart/chart/ChartComposite.java
bundles/org.simantics.jfreechart/src/org/simantics/jfreechart/chart/ChartComposite2.java

index 53cdf1c4cbae51ed482c6a07ef6e342ab68dfc72..bd898d89414b99cf1c887bbe7d945837846c5f37 100644 (file)
@@ -113,7 +113,7 @@ public class ChartComposite extends Composite {
                public IJFreeChart perform(ReadGraph graph) throws DatabaseException {
                        // Adapt chartResource to a chart (XY, pie, bar, ...)
             if(graph.isInstanceOf(chartResource, JFreeChartResource.getInstance(graph).Chart)) {
-               return  graph.adapt(chartResource, IJFreeChart.class);
+               return  graph.adaptUnique(chartResource, IJFreeChart.class);
             } else {
                 return null;
             }
index 0efffbc3d38b43dfc5b88ed7aede36ee7ecd95d2..bdd275ad8c14bc5c750b0b26cd93387a0e745215 100644 (file)
@@ -143,7 +143,7 @@ public class ChartComposite2 extends SWTAWTComponent {
                public IJFreeChart perform(ReadGraph graph) throws DatabaseException {
                        // Adapt chartResource to a chart (XY, pie, bar, ...)
             if(graph.isInstanceOf(chartResource, JFreeChartResource.getInstance(graph).Chart)) {
-               return  graph.adapt(chartResource, IJFreeChart.class);
+               return  graph.adaptUnique(chartResource, IJFreeChart.class);
             } else {
                 return null;
             }