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; 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; procedure InternalFinal;
begin begin
if Assigned(MainPool) then if Assigned(MainPool) then
@ -689,13 +696,6 @@ end;
// the implementation of the extra LCL interface methods // the implementation of the extra LCL interface methods
{$I cocoalclintf.inc} {$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); procedure TCocoaWidgetSet.DoSetMainMenu(AMenu: NSMenu; ALCLMenu: TMenu);
var var
i: Integer; i: Integer;
@ -850,7 +850,6 @@ end;
initialization initialization
// {$I Cocoaimages.lrs} // {$I Cocoaimages.lrs}
InternalInit;
finalization finalization
InternalFinal; InternalFinal;

View File

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