mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 310104 mem-leak: Don't cache ICProject / ICConfigurationDescription when IndexProviderManagerTests aren't running
This commit is contained in:
parent
1e118a7e58
commit
c01b11c194
3 changed files with 15 additions and 1 deletions
|
@ -24,11 +24,15 @@ public class AbstractDummyProvider implements IReadOnlyPDOMProvider {
|
|||
public AbstractDummyProvider() {}
|
||||
|
||||
public IPDOMDescriptor[] getDescriptors(ICConfigurationDescription config) {
|
||||
if (!DummyProviderTraces.getInstance().enabled)
|
||||
return new IPDOMDescriptor[0];
|
||||
DummyProviderTraces.getInstance().getCfgsTrace(getClass()).add(config);
|
||||
return new IPDOMDescriptor[0];
|
||||
}
|
||||
|
||||
public boolean providesFor(ICProject project) throws CoreException {
|
||||
if (!DummyProviderTraces.getInstance().enabled)
|
||||
return true;
|
||||
DummyProviderTraces.getInstance().getProjectsTrace(getClass()).add(project);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,10 @@ public class DummyProviderTraces {
|
|||
static DummyProviderTraces instance = new DummyProviderTraces();
|
||||
|
||||
public static DummyProviderTraces getInstance() { return instance; }
|
||||
|
||||
|
||||
/** Flag indicates if test is enabled, so we should trace projects and configs */
|
||||
public volatile boolean enabled;
|
||||
|
||||
private DummyProviderTraces() {}
|
||||
|
||||
Map/*<String, List>*/ id2prjTrace= new HashMap();
|
||||
|
|
|
@ -94,8 +94,15 @@ public class IndexProviderManagerTest extends IndexTestBase {
|
|||
return suite(IndexProviderManagerTest.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
DPT.enabled = true;
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
DPT.enabled = false;
|
||||
IndexProviderManager ipm= ((PDOMManager)CCorePlugin.getIndexManager()).getIndexProviderManager();
|
||||
ipm.reset(); ipm.startup();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue