summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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];
}
}