mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 20:09:18 +02:00
* instead of registering all and then deleting non-propgetter/setter procdefs in
pdecvar.read_property_dec, don't register them by default, and then only register them, if they are propgetter/setter. This prevents dangling pointers in current_module.deflist and potential use-after-free bugs. git-svn-id: trunk@48998 -
This commit is contained in:
parent
9e9859f145
commit
d608b4b689
@ -360,8 +360,8 @@ implementation
|
|||||||
{ Generate temp procdefs to search for matching read/write
|
{ Generate temp procdefs to search for matching read/write
|
||||||
procedures. the readprocdef will store all definitions }
|
procedures. the readprocdef will store all definitions }
|
||||||
paranr:=0;
|
paranr:=0;
|
||||||
readprocdef:=cprocdef.create(normal_function_level,true);
|
readprocdef:=cprocdef.create(normal_function_level,false);
|
||||||
writeprocdef:=cprocdef.create(normal_function_level,true);
|
writeprocdef:=cprocdef.create(normal_function_level,false);
|
||||||
|
|
||||||
readprocdef.struct:=astruct;
|
readprocdef.struct:=astruct;
|
||||||
writeprocdef.struct:=astruct;
|
writeprocdef.struct:=astruct;
|
||||||
@ -857,11 +857,14 @@ implementation
|
|||||||
message1(parser_e_implements_uses_non_implemented_interface,def.typename);
|
message1(parser_e_implements_uses_non_implemented_interface,def.typename);
|
||||||
until not try_to_consume(_COMMA);
|
until not try_to_consume(_COMMA);
|
||||||
|
|
||||||
{ remove unneeded procdefs }
|
{ register propgetter and propsetter procdefs }
|
||||||
if readprocdef.proctypeoption<>potype_propgetter then
|
if assigned(current_module) and current_module.in_interface then
|
||||||
readprocdef.owner.deletedef(readprocdef);
|
begin
|
||||||
if writeprocdef.proctypeoption<>potype_propsetter then
|
if readprocdef.proctypeoption=potype_propgetter then
|
||||||
writeprocdef.owner.deletedef(writeprocdef);
|
readprocdef.register_def;
|
||||||
|
if writeprocdef.proctypeoption=potype_propsetter then
|
||||||
|
writeprocdef.register_def;
|
||||||
|
end;
|
||||||
|
|
||||||
result:=p;
|
result:=p;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user