Keep and drop context in the TRTTIContext.

This commit is contained in:
Henrique Gottardi Werlang 2023-01-27 08:14:03 -03:00 committed by Michael Van Canneyt
parent 05e0c745d5
commit 5612d3812f

View File

@ -97,6 +97,9 @@ type
function GetType(aTypeInfo: PTypeInfo): TRTTIType; overload;
function GetType(aClass: TClass): TRTTIType; overload;
function GetTypes: specialize TArray<TRttiType>;
class procedure KeepContext; static;
class procedure DropContext; static;
end;
{ TRttiObject }
@ -1589,6 +1592,16 @@ begin
Result := specialize TArray<TRttiType>(TJSObject.Values(Pool.FTypes));
end;
class procedure TRTTIContext.KeepContext;
begin
Pool.AcquireContext;
end;
class procedure TRTTIContext.DropContext;
begin
Pool.ReleaseContext;
end;
{ TRttiObject }
constructor TRttiObject.Create(AParent: TRttiObject; AHandle: Pointer);