From 3b7ff83e0475da627233321f1f926f40bccbec87 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Fri, 25 Mar 2011 23:17:16 +0000 Subject: Fix STR #2595. Mac OS. When deleting a subwindow, don't delete the Cocoa window (xid) attached to it because it is in fact the Cocoa window of its parent window. I check that by making sure that none of the windows in the window list uses this Cocoa window. Is there a better algorithm ? git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8534 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_cocoa.mm | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index fc7cb7a22..bab8ce6bd 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -2573,6 +2573,15 @@ void Fl_X::relink(Fl_Window *w, Fl_Window *wp) { void Fl_X::destroy() { if (w && !w->parent() && xid) { + /* Fix for STR #2595: don't delete the xid of a subwindow because it is shared + with the xid of its parent window. + The link from subwindow to parent may have been removed already. + This algorithm makes sure that none of the windows of the window list uses this xid. + Is there a better algorithm ? + */ + for (Fl_X *xo = Fl_X::first; xo; xo = xo->next) { + if (xo->xid == xid) return; + } [[(NSWindow *)xid contentView] release]; [(NSWindow *)xid close]; } -- cgit v1.2.3