cocoa: making mainpool lazy initialization - moving to AppInit, to prevent conflicts with dynlib loading. bug #36360

git-svn-id: trunk@62352 -
This commit is contained in:
dmitry 2019-12-08 05:03:08 +00:00
parent 79faff4c47
commit 62ef41f719
2 changed files with 9 additions and 8 deletions

View File

@ -673,6 +673,13 @@ begin
end;
procedure InternalInit;
begin
// MacOSX 10.6 reports a lot of warnings during initialization process
// adding the autorelease pool for the whole Cocoa widgetset
MainPool := NSAutoreleasePool.alloc.init;
end;
procedure InternalFinal;
begin
if Assigned(MainPool) then
@ -689,13 +696,6 @@ end;
// the implementation of the extra LCL interface methods
{$I cocoalclintf.inc}
procedure InternalInit;
begin
// MacOSX 10.6 reports a lot of warnings during initialization process
// adding the autorelease pool for the whole Cocoa widgetset
MainPool := NSAutoreleasePool.alloc.init;
end;
procedure TCocoaWidgetSet.DoSetMainMenu(AMenu: NSMenu; ALCLMenu: TMenu);
var
i: Integer;
@ -850,7 +850,6 @@ end;
initialization
// {$I Cocoaimages.lrs}
InternalInit;
finalization
InternalFinal;

View File

@ -31,6 +31,8 @@ begin
{$IFDEF VerboseObject}
DebugLn('TCocoaWidgetSet.AppInit');
{$ENDIF}
InternalInit;
WakeMainThread := @OnWakeMainThread;
ScreenInfo.PixelsPerInchX := CocoaBasePPI;
ScreenInfo.PixelsPerInchY := CocoaBasePPI;