avoid crash if active_child_frame is not set yet

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30105 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2004-10-27 00:58:00 +00:00
parent 1b135c93ed
commit 1b10056f63
2 changed files with 22 additions and 18 deletions

View File

@@ -170,17 +170,19 @@ void wxMDIParentFrame::OnInternalIdle()
/* need to set the menubar of the child */ /* need to set the menubar of the child */
wxMDIChildFrame *active_child_frame = GetActiveChild(); wxMDIChildFrame *active_child_frame = GetActiveChild();
wxMenuBar *menu_bar = active_child_frame->m_menuBar; if (active_child_frame != NULL)
if (menu_bar)
{ {
menu_bar->m_width = m_width; wxMenuBar *menu_bar = active_child_frame->m_menuBar;
menu_bar->m_height = wxMENU_HEIGHT; if (menu_bar)
gtk_pizza_set_size( GTK_PIZZA(m_mainWidget), {
menu_bar->m_widget, menu_bar->m_width = m_width;
0, 0, m_width, wxMENU_HEIGHT ); menu_bar->m_height = wxMENU_HEIGHT;
menu_bar->SetInvokingWindow(active_child_frame); gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
menu_bar->m_widget,
0, 0, m_width, wxMENU_HEIGHT );
menu_bar->SetInvokingWindow(active_child_frame);
}
} }
m_justInserted = false; m_justInserted = false;
return; return;
} }

View File

@@ -170,17 +170,19 @@ void wxMDIParentFrame::OnInternalIdle()
/* need to set the menubar of the child */ /* need to set the menubar of the child */
wxMDIChildFrame *active_child_frame = GetActiveChild(); wxMDIChildFrame *active_child_frame = GetActiveChild();
wxMenuBar *menu_bar = active_child_frame->m_menuBar; if (active_child_frame != NULL)
if (menu_bar)
{ {
menu_bar->m_width = m_width; wxMenuBar *menu_bar = active_child_frame->m_menuBar;
menu_bar->m_height = wxMENU_HEIGHT; if (menu_bar)
gtk_pizza_set_size( GTK_PIZZA(m_mainWidget), {
menu_bar->m_widget, menu_bar->m_width = m_width;
0, 0, m_width, wxMENU_HEIGHT ); menu_bar->m_height = wxMENU_HEIGHT;
menu_bar->SetInvokingWindow(active_child_frame); gtk_pizza_set_size( GTK_PIZZA(m_mainWidget),
menu_bar->m_widget,
0, 0, m_width, wxMENU_HEIGHT );
menu_bar->SetInvokingWindow(active_child_frame);
}
} }
m_justInserted = false; m_justInserted = false;
return; return;
} }