summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2011-09-02 12:15:43 +0000
committerManolo Gouy <Manolo>2011-09-02 12:15:43 +0000
commit21ddc8900c7281457277e795237bb56c18471f4b (patch)
tree2a5eac3a56ac1893923a3cdcd3023b7166e5920c /src
parente758e6aac267b2e92af7e19a43cb2f518ba542d1 (diff)
Before deleting a window, it's better to check whether it contains the currently focused NSView,
and unlock focus there. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9026 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_cocoa.mm6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index 8c69d4631..f7cdab7aa 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -2625,7 +2625,11 @@ void Fl_X::relink(Fl_Window *w, Fl_Window *wp) {
void Fl_X::destroy() {
// subwindows share their xid with their parent window, so should not close it
if (!subwindow && w && !w->parent() && xid) {
- [[(NSWindow *)xid contentView] release];
+ NSView *topview = [(NSWindow *)xid contentView];
+ if ( [NSView focusView] == topview ) {
+ [topview unlockFocus];
+ }
+ [topview release];
[(NSWindow *)xid close];
}
}