You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by jt...@apache.org on 2020/12/26 14:40:16 UTC

[netbeans-html4j] 21/25: Remove done javascript items from the stack

This is an automated email from the ASF dual-hosted git repository.

jtulach pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans-html4j.git

commit ddf50597f17c0dc730765da7c6abb6d091e23936
Author: Jaroslav Tulach <ja...@apidesign.org>
AuthorDate: Thu Dec 24 09:31:31 2020 +0100

    Remove done javascript items from the stack
---
 .../main/java/org/netbeans/html/presenters/spi/Generic.java    | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java b/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java
index 1da8eb7..3a6a331 100644
--- a/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java
+++ b/generic/src/main/java/org/netbeans/html/presenters/spi/Generic.java
@@ -579,10 +579,10 @@ abstract class Generic implements Fn.Presenter, Fn.KeepAlive, Flushable {
 
         protected String sj(boolean[] finished) {
             finished[0] = false;
-            if (Boolean.TRUE.equals(done)) {
+            if (done != null) {
                 return null;
             }
-            done = true;
+            done = false;
             return "javascript:" + toExec;
         }
 
@@ -592,6 +592,7 @@ abstract class Generic implements Fn.Presenter, Fn.KeepAlive, Flushable {
             }
             this.typeof = typeof;
             this.result = result;
+            this.done = true;
             log(Level.FINE, "result ({0}): {1} for {2}", typeof, result, toExec);
         }
     } // end of Item
@@ -618,7 +619,7 @@ abstract class Generic implements Fn.Presenter, Fn.KeepAlive, Flushable {
                 return;
             }
             Item it = top;
-            while (it != null) {
+            while (it.prev != null) {
                 Item process = it.prev;
                 if (process.id == id) {
                     process.result(typeof, res);
@@ -1027,6 +1028,9 @@ abstract class Generic implements Fn.Presenter, Fn.KeepAlive, Flushable {
 
     private Item registerCall(Item call) {
         assert Thread.holdsLock(lock());
+        while (call != null && call.method == null && Boolean.TRUE.equals(call.done)) {
+            call = call.prev;
+        }
         this.call = call;
         lock().notifyAll();
         return call;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists