mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-14 07:49:21 +02:00
* Call management initialize operator for records inside classes (record with management operators as field) (rtl/inc/objpas.inc, TObject.InitInstance)
git-svn-id: trunk@35449 -
This commit is contained in:
parent
9a9eb1b840
commit
5a7d4eb25f
@ -379,6 +379,11 @@
|
||||
|
||||
class function TObject.InitInstance(instance : pointer) : tobject; {$ifdef SYSTEMINLINE} inline; {$ENDIF}
|
||||
|
||||
{$ifdef FPC_HAS_MANAGEMENT_OPERATORS}
|
||||
var
|
||||
vmt : PVmt;
|
||||
temp : pointer;
|
||||
{$endif FPC_HAS_MANAGEMENT_OPERATORS}
|
||||
begin
|
||||
{ the size is saved at offset 0 }
|
||||
fillchar(instance^, InstanceSize, 0);
|
||||
@ -387,6 +392,21 @@
|
||||
ppointer(instance)^:=pointer(self);
|
||||
if {$ifdef VER3_0}PVmt(self)^.vIntfTable <> @emptyintf{$else}assigned(PVmt(self)^.vIntfTable){$endif} then
|
||||
InitInterfacePointers(self,instance);
|
||||
|
||||
{$ifdef FPC_HAS_MANAGEMENT_OPERATORS}
|
||||
{ for management operators like initialize call int_initialize }
|
||||
vmt := PVmt(self);
|
||||
while vmt<>nil do
|
||||
begin
|
||||
Temp:= vmt^.vInitTable;
|
||||
{ The RTTI format matches one for records, except the type is tkClass.
|
||||
Since RecordRTTI does not check the type, calling it yields the desired result. }
|
||||
if Assigned(Temp) then
|
||||
RecordRTTI(Instance,Temp,@int_initialize);
|
||||
vmt:= vmt^.vParent;
|
||||
end;
|
||||
{$endif FPC_HAS_MANAGEMENT_OPERATORS}
|
||||
|
||||
InitInstance:=TObject(Instance);
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user