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 2017/11/29 05:05:55 UTC
[incubator-netbeans-html4j] 02/03: Cleanup watches if they loose
their proto object
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/incubator-netbeans-html4j.git
commit f2602e6254b63516d2785cab74f6131741b46703
Author: Jaroslav Tulach <ja...@oracle.com>
AuthorDate: Wed Nov 29 06:04:23 2017 +0100
Cleanup watches if they loose their proto object
---
.../main/java/org/netbeans/html/json/spi/Observers.java | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/json/src/main/java/org/netbeans/html/json/spi/Observers.java b/json/src/main/java/org/netbeans/html/json/spi/Observers.java
index 622f8dc..e49b162 100644
--- a/json/src/main/java/org/netbeans/html/json/spi/Observers.java
+++ b/json/src/main/java/org/netbeans/html/json/spi/Observers.java
@@ -154,20 +154,18 @@ final class Observers {
Iterator<Ref> it = mine.observers.iterator();
while (it.hasNext()) {
Ref ref = it.next();
- if (ref.get() == null) {
+ Watcher w = ref.watcher();
+ if (w == null || w.proto == null) {
it.remove();
continue;
}
if (ref.prop.equals(propName)) {
- Watcher w = ref.watcher();
- if (w != null) {
- mutated.add(w);
- }
+ mutated.add(w);
}
}
}
for (Watcher w : mutated) {
- w.proto.valueHasMutated(w.prop);
+ w.valueHasMutated();
}
}
@@ -213,6 +211,13 @@ final class Observers {
void destroy() {
proto = null;
}
+
+ void valueHasMutated() {
+ Proto p = proto;
+ if (p != null) {
+ p.valueHasMutated(prop);
+ }
+ }
}
static final class Usages {
--
To stop receiving notification emails like this one, please contact
"commits@netbeans.apache.org" <co...@netbeans.apache.org>.