Fix hang when reparenting a frozen window in wxOSX
The wrong order of changing parent and freezing/thawing could result in hanging the application when reparenting frozen windows, e.g. when switching order of pages in a notebook. Closes #16722.
This commit is contained in:
@@ -1638,6 +1638,15 @@ void wxWindowMac::RemoveChild( wxWindowBase *child )
|
||||
if ( child == m_growBox )
|
||||
m_growBox = NULL ;
|
||||
#endif
|
||||
if (!child->IsBeingDeleted() && !child->IsTopLevel())
|
||||
{
|
||||
// Must be removed prior to RemoveChild and next AddChild call
|
||||
// Otherwise the next AddChild may freeze the wrong window
|
||||
wxWindowMac *mac = (wxWindowMac *)child;
|
||||
if (mac->GetPeer() && mac->GetPeer()->IsOk())
|
||||
mac->GetPeer()->RemoveFromParent();
|
||||
}
|
||||
|
||||
wxWindowBase::RemoveChild( child ) ;
|
||||
}
|
||||
|
||||
@@ -2458,10 +2467,9 @@ bool wxWindowMac::Reparent(wxWindowBase *newParentBase)
|
||||
if ( !wxWindowBase::Reparent(newParent) )
|
||||
return false;
|
||||
|
||||
GetPeer()->RemoveFromParent();
|
||||
GetPeer()->Embed( GetParent()->GetPeer() );
|
||||
|
||||
MacChildAdded();
|
||||
GetParent()->MacChildAdded();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user