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
This commit is contained in:
Manolo Gouy 2011-03-25 23:17:16 +00:00
parent f088e583a1
commit 3b7ff83e04

View File

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