Cocoa: Remove unused NSApp delegate that created memory leaks and crashes with libraries.

git-svn-id: trunk@44371 -
This commit is contained in:
freq 2014-03-07 19:59:05 +00:00
parent c1866d58c7
commit 0a82041306
3 changed files with 5 additions and 18 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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