From db3182f4f4844f4bb154195ab2cb0fbd95075886 Mon Sep 17 00:00:00 2001 From: David Inglis Date: Thu, 30 Oct 2003 03:08:44 +0000 Subject: [PATCH] Fix for 45734 & 45736 --- core/org.eclipse.cdt.core/ChangeLog | 9 +++++ .../internal/core/model/CModelManager.java | 35 ++++++++++--------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/core/org.eclipse.cdt.core/ChangeLog b/core/org.eclipse.cdt.core/ChangeLog index 6b5d886747c..425157bb514 100644 --- a/core/org.eclipse.cdt.core/ChangeLog +++ b/core/org.eclipse.cdt.core/ChangeLog @@ -1,3 +1,12 @@ +2003-10-29 David Inglis + + Fix for 45734 & 45736, Though this only addresses a small part on the later. + + Prevents child element creation when releasing parent element + Prevent binary file check when have already obtained a translation unit. + + * model/org/eclipse/cdt/internal/core/CModelManager.java + 2003-10-29 Alain Magloire Fix for PR 45733 diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java index 7274a9421de..3f98bcd7fb3 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/CModelManager.java @@ -215,9 +215,8 @@ public class CModelManager implements IResourceChangeListener { ICElement cfile = null; if (isTranslationUnit(file)) { - cfile = new TranslationUnit(parent, file);} - - if (file.exists()) { + cfile = new TranslationUnit(parent, file); + } else if (file.exists()) { // Try to create the binaryFile first. if (bin == null) { bin = createBinaryFile(file); @@ -313,21 +312,23 @@ public class CModelManager implements IResourceChangeListener { } if (celement instanceof IParent) { - CElementInfo info = ((CElement)celement).getElementInfo(); - if (info != null) { - ICElement[] children = info.getChildren(); - for (int i = 0; i < children.length; i++) { - releaseCElement(children[i]); - } - // Make sure we destroy the BinaryContainer and ArchiveContainer - // Since they are not part of the children. - if (info instanceof CProjectInfo) { - CProjectInfo pinfo = (CProjectInfo) info; - if (pinfo.vBin != null) { - releaseCElement(pinfo.vBin); + if ( peekAtInfo(celement) != null ) { + CElementInfo info = ((CElement)celement).getElementInfo(); + if (info != null) { + ICElement[] children = info.getChildren(); + for (int i = 0; i < children.length; i++) { + releaseCElement(children[i]); } - if (pinfo.vLib != null) { - releaseCElement(pinfo.vLib); + // Make sure we destroy the BinaryContainer and ArchiveContainer + // Since they are not part of the children. + if (info instanceof CProjectInfo) { + CProjectInfo pinfo = (CProjectInfo) info; + if (pinfo.vBin != null) { + releaseCElement(pinfo.vBin); + } + if (pinfo.vLib != null) { + releaseCElement(pinfo.vLib); + } } } }