Browse Source

fcl-passrc: fixed releasing canonical set of anonymous enumtype

git-svn-id: trunk@36241 -
Mattias Gaertner 8 years ago
parent
commit
0c66d8b362
2 changed files with 4 additions and 1 deletions
  1. 3 1
      packages/fcl-passrc/src/pasresolver.pp
  2. 1 0
      packages/fcl-passrc/src/pastree.pp

+ 3 - 1
packages/fcl-passrc/src/pasresolver.pp

@@ -3497,8 +3497,10 @@ begin
     EnumScope:=TPasEnumTypeScope(El.CustomData);
     if EnumScope.CanonicalSet<>Parent then
       begin
-      ReleaseAndNil(TPasElement(EnumScope.CanonicalSet));
+      if EnumScope.CanonicalSet<>nil then
+        EnumScope.CanonicalSet.Release;
       EnumScope.CanonicalSet:=TPasSetType(Parent);
+      Parent.AddRef;
       end;
     end;
 end;

+ 1 - 0
packages/fcl-passrc/src/pastree.pp

@@ -2094,6 +2094,7 @@ begin
     {$if defined(debugrefcount) or defined(VerbosePasTreeMem)}writeln('TPasElement.Destroy ',Name,':',ClassName);{$ENDIF}
     raise Exception.Create('');
     end;
+  FParent:=nil;
   inherited Destroy;
 end;