From: David Elliott Date: Mon, 9 Feb 2004 04:44:30 +0000 (+0000) Subject: When destroying the window, only remove it from its Cocoa parent if X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/6ba13ca442398185bece1943b40b4d4df79bcdbf When destroying the window, only remove it from its Cocoa parent if the Cocoa window for its wxWindows parent is its Cocoa parent. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25679 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/cocoa/window.mm b/src/cocoa/window.mm index 2bcdeb8c73..28ea18d0ea 100644 --- a/src/cocoa/window.mm +++ b/src/cocoa/window.mm @@ -279,7 +279,10 @@ wxWindow::~wxWindow() wxAutoNSAutoreleasePool pool; DestroyChildren(); - CocoaRemoveFromParent(); + // Make sure our parent (in the wxWindows sense) is our superview + // before we go removing from it. + if(m_parent && m_parent->GetNSView()==[GetNSViewForSuperview() superview]) + CocoaRemoveFromParent(); delete m_cocoaHider; delete m_cocoaScroller; SetNSView(NULL);