X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fjavascript%2FJSFunctionExec.java;h=93b35e54eacef6680350619f9ff31fdb0bfd2b09;hb=a45774ee31d9f35d4eff46d54d7deab719afb092;hp=8eb0bd9f4ccd7e428cc96f9bbf38d748d0c04401;hpb=bee1b05e923ca592565d6c1161717321947dff7b;p=jalview.git diff --git a/src/jalview/javascript/JSFunctionExec.java b/src/jalview/javascript/JSFunctionExec.java index 8eb0bd9..93b35e5 100644 --- a/src/jalview/javascript/JSFunctionExec.java +++ b/src/jalview/javascript/JSFunctionExec.java @@ -1,3 +1,20 @@ +/******************************************************************************* + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) + * Copyright (C) 2011 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + *******************************************************************************/ package jalview.javascript; import java.net.URL; @@ -9,7 +26,7 @@ import jalview.bin.JalviewLite; public class JSFunctionExec implements Runnable { - JalviewLite jvlite; + public JalviewLite jvlite; public JSFunctionExec(JalviewLite applet) { @@ -18,7 +35,15 @@ public class JSFunctionExec implements Runnable jsExecQueue = jvlite.getJsExecQueue(); jvlite.setExecutor(this); } - + public void finalize() { + jvlite=null; + executor=null; + if (jsExecQueue!=null) + { + jsExecQueue.clear(); + } + jsExecQueue=null; + } private Vector jsExecQueue; private Thread executor = null; @@ -27,18 +52,27 @@ public class JSFunctionExec implements Runnable { if (jsExecQueue != null) { + Vector q=null; synchronized (jsExecQueue) { - Vector q = jsExecQueue; - q.removeAllElements(); + q = jsExecQueue; jsExecQueue = null; + } + if (q!=null ) { + for (JSFunctionExec jx : q) + { + jx.jvlite=null; + + } + q.removeAllElements(); synchronized (q) { q.notifyAll(); } } - executor = null; } + jvlite=null; + executor = null; } public void run()