1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Avoid deadlock in CDescriptorTests, Bug 196118

This commit is contained in:
Anton Leherbauer 2008-10-03 10:46:01 +00:00
parent 4044254d66
commit 243ac4f836

View file

@ -27,7 +27,6 @@ import org.eclipse.cdt.core.ICDescriptorOperation;
import org.eclipse.cdt.core.ICExtensionReference; import org.eclipse.cdt.core.ICExtensionReference;
import org.eclipse.cdt.core.ICOwnerInfo; import org.eclipse.cdt.core.ICOwnerInfo;
import org.eclipse.cdt.core.testplugin.CTestPlugin; import org.eclipse.cdt.core.testplugin.CTestPlugin;
import org.eclipse.cdt.internal.core.CConfigBasedDescriptor;
import org.eclipse.cdt.internal.core.pdom.PDOMManager; import org.eclipse.cdt.internal.core.pdom.PDOMManager;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription; import org.eclipse.core.resources.IProjectDescription;
@ -212,11 +211,13 @@ public class CDescriptorTests extends TestCase {
// //
// descriptor.saveProjectData() doesn't actually save despite what the API says // descriptor.saveProjectData() doesn't actually save despite what the API says
// see CConfigBasedDescriptor.fApplyOnChange // see CConfigBasedDescriptor.fApplyOnChange
descriptor.saveProjectData(); // ((CConfigBasedDescriptor)descriptor).apply(false);
((CConfigBasedDescriptor)descriptor).apply(false);
// System.out.println("Saved " + test); // System.out.println("Saved " + test);
}}; }};
CCorePlugin.getDefault().getCDescriptorManager().runDescriptorOperation(fProject, operation, null); CCorePlugin.getDefault().getCDescriptorManager().runDescriptorOperation(fProject, operation, null);
ICDescriptor descriptor = CCorePlugin.getDefault().getCDescriptorManager().getDescriptor(fProject);
// perform apply outside descriptor operation to avoid deadlock - http://bugs.eclipse.org/241288
descriptor.saveProjectData();
} catch (Throwable exc) { } catch (Throwable exc) {
exception[indexj]= exc; exception[indexj]= exc;
exc.printStackTrace(); exc.printStackTrace();
@ -230,7 +231,7 @@ public class CDescriptorTests extends TestCase {
if (threads[j] != null) { if (threads[j] != null) {
threads[j].join(); threads[j].join();
} }
assertNull(exception[j]); assertNull("Exception occurred: "+exception[j], exception[j]);
} }
desc= CCorePlugin.getDefault().getCProjectDescription(fProject, true); desc= CCorePlugin.getDefault().getCProjectDescription(fProject, true);
int lengthAfter = countChildElements(desc.getProjectData("testElement")); int lengthAfter = countChildElements(desc.getProjectData("testElement"));