mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-25 23:22:28 +02:00
cocoa: doing the proper time release of the main autorelease pool. #35400
git-svn-id: trunk@61160 -
This commit is contained in:
parent
a17ed6695c
commit
14eaeb1c76
lcl/interfaces/cocoa
@ -532,6 +532,16 @@ begin
|
||||
Result:=inherited runModalForWindow(theWindow);
|
||||
end;
|
||||
|
||||
|
||||
procedure InternalFinal;
|
||||
begin
|
||||
if Assigned(MainPool) then
|
||||
begin
|
||||
MainPool.release;
|
||||
MainPool := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
// the implementation of the utility methods
|
||||
{$I cocoaobject.inc}
|
||||
// the implementation of the winapi compatibility methods
|
||||
@ -546,12 +556,6 @@ begin
|
||||
MainPool := NSAutoreleasePool.alloc.init;
|
||||
end;
|
||||
|
||||
procedure InternalFinal;
|
||||
begin
|
||||
if Assigned(MainPool) then MainPool.release;
|
||||
end;
|
||||
|
||||
|
||||
procedure TCocoaWidgetSet.DoSetMainMenu(AMenu: NSMenu; ALCLMenu: TMenu);
|
||||
var
|
||||
i: Integer;
|
||||
@ -668,7 +672,6 @@ end;
|
||||
|
||||
initialization
|
||||
// {$I Cocoaimages.lrs}
|
||||
|
||||
InternalInit;
|
||||
|
||||
finalization
|
||||
|
@ -222,6 +222,13 @@ begin
|
||||
|
||||
// NSApp.terminate(nil); // causes app to quit immediately, which is undesirable
|
||||
|
||||
// Must release the Main autorelease pool here.
|
||||
// Some objects still in the pool my depend on releasing Widgetset objects
|
||||
// (i.e. images). If autorelease pool is released After the widgetset object
|
||||
// then it finalization of WS dependent objects would fail (suppressed AVs)
|
||||
// and would cause leaks. (see #35400)
|
||||
InternalFinal;
|
||||
|
||||
CocoaWidgetSet := nil;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user