mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-09 19:57:45 +01:00
Cocoa: Remove unused NSApp delegate that created memory leaks and crashes with libraries.
git-svn-id: trunk@44371 -
This commit is contained in:
parent
c1866d58c7
commit
0a82041306
@ -49,11 +49,6 @@ type
|
||||
class function initWithFunc(afunc: TWSTimerProc): TCocoaTimerObject; message 'initWithFunc:';
|
||||
end;
|
||||
|
||||
{ TCocoaAppDelegate }
|
||||
|
||||
TCocoaAppDelegate = objcclass(NSObject, NSApplicationDelegateProtocol)
|
||||
function applicationShouldTerminate(sender: NSApplication): NSApplicationTerminateReply; message 'applicationShouldTerminate:';
|
||||
end;
|
||||
|
||||
{ TCocoaWidgetSet }
|
||||
|
||||
@ -63,7 +58,7 @@ type
|
||||
FNSApp: NSApplication;
|
||||
FCurrentCursor: HCursor;
|
||||
FCaptureControl: HWND;
|
||||
delegate: TCocoaAppDelegate;
|
||||
|
||||
protected
|
||||
FStockNullBrush: HBRUSH;
|
||||
FStockBlackBrush: HBRUSH;
|
||||
|
||||
@ -25,19 +25,15 @@
|
||||
Initialize Carbon Widget Set
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TCocoaWidgetSet.AppInit(var ScreenInfo: TScreenInfo);
|
||||
var pool: NSAutoreleasePool;
|
||||
begin
|
||||
{$IFDEF VerboseObject}
|
||||
DebugLn('TCocoaWidgetSet.AppInit');
|
||||
{$ENDIF}
|
||||
|
||||
delegate := TCocoaAppDelegate.alloc.init;
|
||||
|
||||
{ Creates the application NSApp object }
|
||||
FNsApp := NSApplication.sharedApplication;
|
||||
pool := NSAutoreleasePool.alloc.init;
|
||||
FNSApp.setDelegate(delegate);
|
||||
pool.release;
|
||||
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -474,13 +470,6 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
{ TCocoaAppDelegate }
|
||||
|
||||
function TCocoaAppDelegate.applicationShouldTerminate(sender: NSApplication): NSApplicationTerminateReply;
|
||||
begin
|
||||
Result := NSTerminateNow;
|
||||
end;
|
||||
|
||||
{ TCocoaTimerObject }
|
||||
|
||||
procedure TCocoaTimerObject.timerEvent;
|
||||
|
||||
@ -1090,15 +1090,18 @@ var
|
||||
obj: NSObject;
|
||||
Callback: ICommonCallback;
|
||||
CallbackObject: TObject;
|
||||
pool: NSAutoreleasePool;
|
||||
begin
|
||||
if not AWinControl.HandleAllocated then
|
||||
Exit;
|
||||
pool := NSAutoreleasePool.alloc.init;
|
||||
obj := NSObject(AWinControl.Handle);
|
||||
if obj.isKindOfClass_(NSView) then
|
||||
NSView(obj).removeFromSuperview
|
||||
else
|
||||
if obj.isKindOfClass_(NSWindow) then
|
||||
NSWindow(obj).close;
|
||||
pool.release;
|
||||
// destroy the callback
|
||||
Callback := obj.lclGetCallback;
|
||||
if Assigned(Callback) then
|
||||
|
||||
Loading…
Reference in New Issue
Block a user