JAL-2864 OverviewCanvas.dispose() for applet
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 8 Jan 2018 11:39:07 +0000 (11:39 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 8 Jan 2018 11:39:07 +0000 (11:39 +0000)
src/jalview/appletgui/OverviewCanvas.java
src/jalview/appletgui/OverviewPanel.java

index 9597b44..03c93fa 100644 (file)
@@ -164,4 +164,12 @@ public class OverviewCanvas extends Component
     }
   }
 
+  /**
+   * Nulls references to protect against potential memory leaks
+   */
+  void dispose()
+  {
+    od = null;
+  }
+
 }
index 8ce597d..4f47913 100755 (executable)
@@ -329,6 +329,10 @@ public class OverviewPanel extends Panel implements Runnable,
     } finally
     {
       av = null;
+      if (oviewCanvas != null)
+      {
+        oviewCanvas.dispose();
+      }
       oviewCanvas = null;
       ap = null;
       od = null;