Skip to content

Commit

Permalink
Fix resource leak issue - 372
Browse files Browse the repository at this point in the history
Scenario - If we have multiple level of parents for chart widget and If
we dispose bottom most(top most is chart) widget by invoking dispose
chart widget get disposed without calling chart.dispose(). Any
subsequent call to dispose never calls dispose for it's children. So
checking if chart disposed in the dispose method never give an
opportunity to children dispose in the above Scenario. I have added
chart disposed safety check at Title because this was causing the issue
#289.

Fixes #372
  • Loading branch information
raghucssit committed Feb 1, 2024
1 parent 9b90a7c commit 56316f3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
10 changes: 4 additions & 6 deletions org.eclipse.swtchart/src/org/eclipse/swtchart/Chart.java
Original file line number Diff line number Diff line change
Expand Up @@ -386,12 +386,10 @@ public void update() {
@Override
public void dispose() {

if(!isDisposed()) {
title.dispose();
legend.dispose();
axisSet.dispose();
super.dispose();
}
title.dispose();
legend.dispose();
axisSet.dispose();
super.dispose();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,9 @@ public ChartLayoutData getLayoutData() {
* Disposes the resources.
*/
public void dispose() {

chart.removePaintListener(this);
if(!chart.isDisposed()) {
chart.removePaintListener(this);
}
}

@Override
Expand Down

0 comments on commit 56316f3

Please sign in to comment.