mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 17:26:01 +02:00
Fix a couple of potential leaks of the PDOM write lock
This fixes a couple of places where a call to PDOM.acquireWriteLock() is not paired with a call to releaseWriteLock() in a finally block. Change-Id: I45a8bd9a2f6585bb4c4bc1f726fea6f9eba5fb43
This commit is contained in:
parent
64709c980d
commit
2fe856426c
2 changed files with 15 additions and 8 deletions
|
@ -61,7 +61,11 @@ public class PDOMTagIndexTests extends BaseTestCase {
|
|||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
pdom.close();
|
||||
try {
|
||||
pdom.close();
|
||||
} finally {
|
||||
pdom.releaseWriteLock();
|
||||
}
|
||||
pdomFile.delete();
|
||||
super.tearDown();
|
||||
}
|
||||
|
|
|
@ -404,14 +404,17 @@ public class PDOMManager implements IWritableIndexManager, IListener {
|
|||
} catch (InterruptedException e) {
|
||||
throw new CoreException(CCorePlugin.createStatus(Messages.PDOMManager_creationOfIndexInterrupted, e));
|
||||
}
|
||||
if (fromScratch) {
|
||||
pdom.setCreatedFromScratch(true);
|
||||
} else {
|
||||
pdom.clear();
|
||||
pdom.setClearedBecauseOfVersionMismatch(true);
|
||||
try {
|
||||
if (fromScratch) {
|
||||
pdom.setCreatedFromScratch(true);
|
||||
} else {
|
||||
pdom.clear();
|
||||
pdom.setClearedBecauseOfVersionMismatch(true);
|
||||
}
|
||||
writeProjectPDOMProperties(pdom, project);
|
||||
} finally {
|
||||
pdom.releaseWriteLock();
|
||||
}
|
||||
writeProjectPDOMProperties(pdom, project);
|
||||
pdom.releaseWriteLock();
|
||||
}
|
||||
pdom.setASTFilePathResolver(new ProjectIndexerInputAdapter(cProject, false));
|
||||
pdom.addListener(this);
|
||||
|
|
Loading…
Add table
Reference in a new issue