git-svn-id: trunk@30024 -
This commit is contained in:
mattias 2011-03-26 21:09:07 +00:00
parent 7dd9af3d88
commit e317ac3780
2 changed files with 4 additions and 28 deletions

View File

@ -1128,8 +1128,8 @@ end;
function TStandardCodeTool.RemoveUnitFromAllUsesSections(
const AnUnitName: string; SourceChangeCache: TSourceChangeCache): boolean;
var SectionNode: TCodeTreeNode;
s: LongInt;
var
SectionNode: TCodeTreeNode;
begin
Result:=false;
if (AnUnitName='') or (SourceChangeCache=nil) then exit;
@ -1138,37 +1138,14 @@ begin
SourceChangeCache.BeginUpdate;
try
SectionNode:=Tree.Root;
// MG: Juha and Zeljko spotted in this function errors
// I can not reproduce it. Either the heap is already buggy, or something updates the tree.
// check the tree:
while (SectionNode<>nil) do begin
if (SectionNode.FirstChild<>nil)
and (SectionNode.FirstChild.Desc=ctnUsesSection) then begin
end;
SectionNode:=SectionNode.NextBrother;
end;
SectionNode:=Tree.Root;
while (SectionNode<>nil) do begin
if (SectionNode.FirstChild<>nil)
and (SectionNode.FirstChild.Desc=ctnUsesSection) then begin
// check if changer is locked
if SourceChangeCache.UpdateLock=0 then
RaiseException('TStandardCodeTool.RemoveUnitFromAllUsesSections inconsistency: missing lock before remove');
s:=TreeChangeStep;
if not RemoveUnitFromUsesSection(SectionNode.FirstChild,AnUnitName,
SourceChangeCache)
then begin
exit;
end;
if SourceChangeCache.UpdateLock=0 then
RaiseException('TStandardCodeTool.RemoveUnitFromAllUsesSections inconsistency: missing lock after remove');
// check if the tree was changed (it should not, because of the lock)
if s<>TreeChangeStep then
RaiseException('TStandardCodeTool.RemoveUnitFromAllUsesSections inconsistency: tree was changed');
end;
SectionNode:=SectionNode.NextBrother;
end;

View File

@ -7537,7 +7537,6 @@ var
ShortUnitName: String;
Dummy: Boolean;
begin
debugln(['TMainIDE.RemoveUnitsFromProject AAA1']);
Result:=mrOk;
if Units=nil then exit;
// check if something will change
@ -7556,7 +7555,7 @@ begin
try
for i:=0 to Units.Count-1 do begin
AnUnitInfo:=TUnitInfo(Units[i]);
debugln(['TMainIDE.RemoveUnitsFromProject Unit ',AnUnitInfo.Filename]);
//debugln(['TMainIDE.RemoveUnitsFromProject Unit ',AnUnitInfo.Filename]);
if not AnUnitInfo.IsPartOfProject then continue;
AnUnitInfo.IsPartOfProject:=false;
AProject.Modified:=true;
@ -7564,7 +7563,7 @@ begin
and (pfMainUnitHasUsesSectionForAllUnits in AProject.Flags)
then begin
ShortUnitName:=ExtractFileNameOnly(AnUnitInfo.Filename);
debugln(['TMainIDE.RemoveUnitsFromProject UnitName=',ShortUnitName]);
//debugln(['TMainIDE.RemoveUnitsFromProject UnitName=',ShortUnitName]);
if (ShortUnitName<>'') then begin
Dummy:=CodeToolBoss.RemoveUnitFromAllUsesSections(
AProject.MainUnitInfo.Source,ShortUnitName);