Don't crash when dismissing expanded ribbon panel.
The parent of wxRibbonPanel is not always a wxRibbonPage, it can also be the containing wxFrame itself if the panel is a temporarily expanded one created when the user clicks a panel reduced to a button. So don't rely on the cast of the parent to wxRibbonPage to always work. This is ugly but at least avoids a crash. Closes #16215. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76437 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1100,7 +1100,9 @@ wxRect wxRibbonPanel::GetExpandedPosition(wxRect panel,
|
||||
|
||||
void wxRibbonPanel::HideIfExpanded()
|
||||
{
|
||||
wxStaticCast(m_parent, wxRibbonPage)->HideIfExpanded();
|
||||
wxRibbonPage* const containingPage = wxDynamicCast(m_parent, wxRibbonPage);
|
||||
if (containingPage)
|
||||
containingPage->HideIfExpanded();
|
||||
}
|
||||
|
||||
#endif // wxUSE_RIBBON
|
||||
|
Reference in New Issue
Block a user