Cocoa: Workaround crash on closing a parented form

git-svn-id: trunk@44114 -
This commit is contained in:
freq 2014-02-17 08:20:40 +00:00
parent 2bafcb57b1
commit 240ff3398d
2 changed files with 5 additions and 3 deletions

View File

@ -373,6 +373,7 @@ type
protected
procedure didBecomeKeyNotification(sender: NSNotification); message 'didBecomeKeyNotification:';
procedure didResignKeyNotification(sender: NSNotification); message 'didResignKeyNotification:';
public
isembedded: Boolean; // true - if the content is inside of another control, false - if the content is in its own window;
ownwin: NSWindow;

View File

@ -437,15 +437,16 @@ var
NSView(APArams.WndParent).addSubView(cnt);
cnt.window.setAcceptsMouseMovedEvents(True);
cnt.callback.IsOpaque:=true;
NSNotificationCenter.defaultCenter.addObserver_selector_name_object(cnt, objcselector('didBecomeKeyNotification:'), NSWindowDidBecomeKeyNotification, cnt.window);
NSNotificationCenter.defaultCenter.addObserver_selector_name_object(cnt, objcselector('didResignKeyNotification:'), NSWindowDidResignKeyNotification, cnt.window);
// todo: We have to find a way to remove the following notifications save before cnt will be released
// NSNotificationCenter.defaultCenter.addObserver_selector_name_object(cnt, objcselector('didBecomeKeyNotification:'), NSWindowDidBecomeKeyNotification, cnt.window);
// NSNotificationCenter.defaultCenter.addObserver_selector_name_object(cnt, objcselector('didResignKeyNotification:'), NSWindowDidResignKeyNotification, cnt.window);
end;
end;
Result := TLCLIntfHandle(cnt);
end;
class function TCocoaWSCustomForm.GetText(const AWinControl: TWinControl; var AText: String): Boolean;
var
win : NSWindow;