void () { ourInstances.remove(myParent); //noinspection SynchronizeOnThis synchronized (this) { for (Iterator<Reference2IntMap.Entry<VirtualFilePointerImpl>> iterator = myCounts.reference2IntEntrySet().fastIterator(); iterator.hasNext(); ) { Reference2IntMap.Entry<VirtualFilePointerImpl> entry = iterator.next(); VirtualFilePointerImpl pointer = entry.getKey(); int disposeCount = entry.getIntValue(); boolean isDisposed = !(pointer instanceof IdentityVirtualFilePointer) && pointer.myNode == null; if (isDisposed) { pointer.throwDisposalError("Already disposed:\n" + pointer.getStackTrace()); } int after = pointer.incrementUsageCount(-(disposeCount - 1)); LOG.assertTrue(after > 0, after); pointer.dispose(); } myCounts.clear(); } }