need to own lock to notify
[jalview.git] / src / jalview / javascript / JSFunctionExec.java
index 9c6f578..47e4538 100644 (file)
@@ -24,10 +24,13 @@ public class JSFunctionExec implements Runnable
   {
     if (jsExecQueue != null)
     {
-      Vector q = jsExecQueue;
-      jsExecQueue = null;
-      q.removeAllElements();
-      executor.notify();
+      synchronized (jsExecQueue)
+      {
+        Vector q = jsExecQueue;
+        q.removeAllElements();
+        jsExecQueue = null;
+        executor.notify();
+      }
       executor = null;
     }
   }