1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-30 20:35:38 +02:00

Bug 297641: Result cache of read-only fragments is not cleared.

This commit is contained in:
Markus Schorn 2010-01-04 09:14:27 +00:00
parent cd89d01394
commit 78e2f65d6d
6 changed files with 22 additions and 1 deletions

View file

@ -139,4 +139,7 @@ public class EmptyIndexFragment implements IIndexFragment {
public Object putCachedResult(Object key, Object value, boolean replace) {
return value;
}
public void clearResultCache() {
}
}

View file

@ -614,6 +614,12 @@ public class CIndex implements IIndex {
}
}
void clearResultCaches() {
for (IIndexFragment frag : fFragments) {
frag.clearResultCache();
}
}
public IIndexFileSet createFileSet() {
return new IndexFileSet();
}

View file

@ -273,4 +273,9 @@ public interface IIndexFragment {
* longer holds a locks.
*/
Object getCachedResult(Object key);
/**
* Clears the result cache.
*/
void clearResultCache();
}

View file

@ -122,6 +122,9 @@ public class WritableCIndex extends CIndex implements IWritableIndex {
fIsWriteLocked= false;
fWritableFragment.releaseWriteLock(establishReadlockCount, flush);
// Bug 297641: Result cache of read only providers needs to be cleared.
clearResultCaches();
}
public void flush() throws CoreException {

View file

@ -1145,7 +1145,7 @@ public class PDOM extends PlatformObject implements IPDOM {
clearResultCache();
}
private void clearResultCache() {
public void clearResultCache() {
synchronized (fResultCache) {
fResultCache.clear();
}

View file

@ -274,4 +274,8 @@ public class PDOMProxy implements IPDOM {
public Object putCachedResult(Object key, Object value, boolean replace) {
return value;
}
public void clearResultCache() {
if (fDelegate != null)
fDelegate.clearResultCache();
}
}