X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.db.impl%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fimpl%2Fquery%2FQueryCollectorImpl.java;h=e6dc252c41f210d00586895aeabe6d7c619001f3;hp=965f1e39f41fb1dc4d99000d533c03dde6c21da3;hb=HEAD;hpb=0ae2b770234dfc3cbb18bd38f324125cf0faca07 diff --git a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryCollectorImpl.java b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryCollectorImpl.java index 965f1e39f..e6dc252c4 100644 --- a/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryCollectorImpl.java +++ b/bundles/org.simantics.db.impl/src/org/simantics/db/impl/query/QueryCollectorImpl.java @@ -42,6 +42,10 @@ class QueryCollectorImpl implements QueryProcessor.QueryCollector { @Override public void collect(int youngTarget, int allowedTimeInMs) { + // Flush listener registrations to prevent the collector from trashing + // listeners that are still queued up waiting to be registered. + queryProcessor.listening.sync(); + long start = System.nanoTime(); // Refresh current size @@ -144,6 +148,7 @@ class QueryCollectorImpl implements QueryProcessor.QueryCollector { } else { + entry.pruneParentSet(); support.setLevel(entry, parent.getLevel() + 1); } @@ -160,7 +165,7 @@ class QueryCollectorImpl implements QueryProcessor.QueryCollector { } } - if(queryProcessor.hasListenerAfterDisposing(entry)) { + if(queryProcessor.listening.hasListenerAfterDisposing(entry)) { if((status & CacheEntry.HAS_BEEN_BOUND) == 0) { queryProcessor.boundQueries++; entry.setGCStatusFlag(CacheEntry.HAS_BEEN_BOUND, true); @@ -176,7 +181,7 @@ class QueryCollectorImpl implements QueryProcessor.QueryCollector { } private boolean tryCollect(CacheEntry entry) { - if (!queryProcessor.hasListenerAfterDisposing(entry)) + if (!queryProcessor.listening.hasListenerAfterDisposing(entry)) if(entry.shouldBeCollected()) { queryProcessor.removeQuery(entry); support.remove();