* overload chaining checks if the procdef is in the same symtable, this

prevents keeping references to staticsymtable only procdefs that are
    not accessible through the globalsymtable. And can cause crashes when
    the staticsymtable is already released.

git-svn-id: trunk@644 -
This commit is contained in:
peter 2005-07-18 09:50:39 +00:00
parent f0efddff9b
commit 24f6bb1594
2 changed files with 16 additions and 13 deletions

View File

@ -634,7 +634,6 @@ interface
tprocdeflist = record
def : tprocdef;
defderef : tderef;
own : boolean;
next : pprocdeflist;
end;

View File

@ -665,8 +665,7 @@ implementation
begin
{ only write the proc definitions that belong
to this procsym and are in the global symtable }
if p^.own and
(p^.def.owner.symtabletype in [globalsymtable,objectsymtable]) then
if p^.def.owner=owner then
inc(n);
p:=p^.next;
end;
@ -677,8 +676,7 @@ implementation
begin
{ only write the proc definitions that belong
to this procsym and are in the global symtable }
if p^.own and
(p^.def.owner.symtabletype in [globalsymtable,objectsymtable]) then
if p^.def.owner=owner then
ppufile.putderef(p^.defderef);
p:=p^.next;
end;
@ -717,7 +715,7 @@ implementation
p:=pdlistfirst;
while assigned(p) do
begin
if p^.own and (p^.def.forwarddef) then
if (p^.def.owner=owner) and (p^.def.forwarddef) then
begin
if (m_mac in aktmodeswitches) and (p^.def.interfacedef) then
import_implict_external(p^.def)
@ -740,7 +738,7 @@ implementation
p:=pdlistfirst;
while assigned(p) do
begin
if p^.own then
if p^.def.owner=owner then
p^.defderef.build(p^.def);
p:=p^.next;
end;
@ -760,7 +758,10 @@ implementation
p:=pdlistfirst;
while assigned(p) do
begin
if not p^.own then
if not(
(p^.def=nil) or
(p^.def.owner=owner)
) then
internalerror(200310291);
p^.def:=tprocdef(p^.defderef.resolve);
p:=p^.next;
@ -776,7 +777,6 @@ implementation
pd^.def:=p;
pd^.defderef.reset;
pd^.next:=nil;
pd^.own:=(pd^.def.procsym=self);
{ Add at end of list to keep always
a correct order, also after loading from ppu }
if assigned(pdlistlast) then
@ -801,7 +801,6 @@ implementation
pd^.def:=nil;
pd^.defderef:=d;
pd^.next:=nil;
pd^.own:=true;
{ Add at end of list to keep always
a correct order, also after loading from ppu }
if assigned(pdlistlast) then
@ -1066,7 +1065,7 @@ implementation
p:=pdlistfirst;
while assigned(p) do
begin
if p^.own then
if p^.def.owner=owner then
p^.def.write_references(ppufile,locals);
p:=p^.next;
end;
@ -1087,7 +1086,12 @@ implementation
while assigned(p) do
begin
hp:=p^.next;
if p^.own then
{ only keep the proc definitions:
- are not deref'd (def=nil)
- are in the same symtable as the procsym (for example both
are in the staticsymtable) }
if (p^.def=nil) or
(p^.def.owner=owner) then
begin
{ keep, add to list }
if assigned(pdlistlast) then
@ -1123,7 +1127,7 @@ implementation
p:=pdlistfirst;
while assigned(p) do
begin
if p^.own and
if (p^.def.owner=owner) and
p^.def.is_visible_for_object(tobjectdef(currobjdef)) then
begin
result:=true;