Browse Source

* fixed memory corruption created by previous fix

peter 23 years ago
parent
commit
2750eb5017
1 changed files with 23 additions and 19 deletions
  1. 23 19
      compiler/pdecsub.pas

+ 23 - 19
compiler/pdecsub.pas

@@ -1618,23 +1618,25 @@ const
             begin
             begin
               include(def.procoptions,po_leftright);
               include(def.procoptions,po_leftright);
               st:=tparasymtable.create;
               st:=tparasymtable.create;
-              parast:=tprocdef(def).parast;
-              lastps:=nil;
-              if parast<>nil then
-              while assigned(parast.symindex.first) and (lastps<>tsym(parast.symindex.first)) do
-                begin
-                  ps:=tsym(parast.symindex.first);
-                  while assigned(ps.indexnext) and (tsym(ps.indexnext)<>lastps) do
-                    ps:=tsym(ps.indexnext);
-                  ps.owner:=st;
-                  { recalculate the corrected offset }
-                  { the really_insert_in_data procedure
-                    for parasymtable should only calculateoffset PM }
-                  tstoredsym(ps).insert_in_data;
-                  { reset the owner correctly }
-                  ps.owner:=parast;
-                  lastps:=ps;
-                end;
+              if def.deftype=procdef then
+               begin
+                 parast:=tprocdef(def).parast;
+                 lastps:=nil;
+                 while assigned(parast.symindex.first) and (lastps<>tsym(parast.symindex.first)) do
+                  begin
+                    ps:=tsym(parast.symindex.first);
+                    while assigned(ps.indexnext) and (tsym(ps.indexnext)<>lastps) do
+                      ps:=tsym(ps.indexnext);
+                    ps.owner:=st;
+                    { recalculate the corrected offset }
+                    { the really_insert_in_data procedure
+                      for parasymtable should only calculateoffset PM }
+                    tstoredsym(ps).insert_in_data;
+                    { reset the owner correctly }
+                    ps.owner:=parast;
+                    lastps:=ps;
+                  end;
+               end;
             end;
             end;
           pocall_register :
           pocall_register :
             begin
             begin
@@ -1756,7 +1758,6 @@ const
         tabstractprocdef(aktprocdef):=pd;
         tabstractprocdef(aktprocdef):=pd;
         { names should never be used anyway }
         { names should never be used anyway }
         inc(lexlevel);
         inc(lexlevel);
-        AktProcDef.parast:=nil;
         parse_proc_directives(pdflags);
         parse_proc_directives(pdflags);
         dec(lexlevel);
         dec(lexlevel);
         aktprocsym.free;
         aktprocsym.free;
@@ -2016,7 +2017,10 @@ const
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.47  2002-03-29 11:23:24  michael
+  Revision 1.48  2002-03-29 13:29:32  peter
+    * fixed memory corruption created by previous fix
+
+  Revision 1.47  2002/03/29 11:23:24  michael
   + Patch from Pavel Ozerski
   + Patch from Pavel Ozerski
 
 
   Revision 1.46  2002/01/24 18:25:49  peter
   Revision 1.46  2002/01/24 18:25:49  peter