Cocoa: BeginMessageProcess/EndMessageProcess implemented, fix resources leak

This commit is contained in:
rich2014 2023-08-26 23:50:13 +08:00
parent 2d1027253f
commit 7f00662152
2 changed files with 14 additions and 0 deletions

View File

@ -201,6 +201,9 @@ type
procedure AppSetIcon(const Small, Big: HICON); override;
procedure AppSetTitle(const ATitle: string); override;
function BeginMessageProcess: TLCLHandle; override;
procedure EndMessageProcess(context: TLCLHandle); override;
function GetLCLCapability(ACapability: TLCLCapability): PtrUInt; override;
function CreateTimer(Interval: integer; TimerFunc: TWSTimerProc): TLCLHandle; override;

View File

@ -124,6 +124,17 @@ begin
AppRunMessages(true, NSDate.distantFuture);
end;
function TCocoaWidgetSet.BeginMessageProcess: TLCLHandle;
begin
Result := TLCLHandle(NSAutoreleasePool.alloc.init);
end;
procedure TCocoaWidgetSet.EndMessageProcess(context: TLCLHandle);
begin
NSAutoreleasePool(context).release;
end;
{------------------------------------------------------------------------------
Method: TCocoaWidgetSet.Create