Notify changes only when the topmost presenter is being cleared batchnotify
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Fri, 13 Sep 2013 11:37:01 +0200
branchbatchnotify
changeset 29806719f52f85a
parent 297 c9b035e84f40
child 299 a0bedae7297e
Notify changes only when the topmost presenter is being cleared
boot/src/main/java/org/apidesign/html/boot/impl/FnUtils.java
     1.1 --- a/boot/src/main/java/org/apidesign/html/boot/impl/FnUtils.java	Fri Sep 13 11:04:17 2013 +0200
     1.2 +++ b/boot/src/main/java/org/apidesign/html/boot/impl/FnUtils.java	Fri Sep 13 11:37:01 2013 +0200
     1.3 @@ -131,13 +131,15 @@
     1.4      }
     1.5      
     1.6      public static Fn.Presenter currentPresenter(Fn.Presenter p) {
     1.7 -        List<Runnable> list = LATER.get();
     1.8 -        LATER.set(null);
     1.9 -        if (list != null) for (Runnable runnable : list) {
    1.10 -            try {
    1.11 -                runnable.run();
    1.12 -            } catch (Throwable t) {
    1.13 -                t.printStackTrace();
    1.14 +        if (p == null) {
    1.15 +            List<Runnable> list = LATER.get();
    1.16 +            LATER.set(null);
    1.17 +            if (list != null) for (Runnable runnable : list) {
    1.18 +                try {
    1.19 +                    runnable.run();
    1.20 +                } catch (Throwable t) {
    1.21 +                    t.printStackTrace();
    1.22 +                }
    1.23              }
    1.24          }
    1.25