From 147d666989aeeefe8c8f23be050d71891afbfd2e Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 30 Sep 2004 16:33:15 +0000 Subject: [PATCH] Fix for crash when the child has no menu git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29562 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/mdi.cpp | 17 ++++++++++------- src/gtk1/mdi.cpp | 17 ++++++++++------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/gtk/mdi.cpp b/src/gtk/mdi.cpp index 131cee85cb..99c278b2d5 100644 --- a/src/gtk/mdi.cpp +++ b/src/gtk/mdi.cpp @@ -168,15 +168,18 @@ void wxMDIParentFrame::OnInternalIdle() GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->m_widget); gtk_notebook_set_page( notebook, g_list_length( notebook->children ) - 1 ); - /* need to set the menubar of the child */ + /* need to set the menubar of the child */ wxMDIChildFrame *active_child_frame = GetActiveChild(); wxMenuBar *menu_bar = active_child_frame->m_menuBar; - menu_bar->m_width = m_width; - menu_bar->m_height = wxMENU_HEIGHT; - gtk_pizza_set_size( GTK_PIZZA(m_mainWidget), - menu_bar->m_widget, - 0, 0, m_width, wxMENU_HEIGHT ); - menu_bar->SetInvokingWindow(active_child_frame); + if (menu_bar) + { + menu_bar->m_width = m_width; + menu_bar->m_height = wxMENU_HEIGHT; + 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; return; diff --git a/src/gtk1/mdi.cpp b/src/gtk1/mdi.cpp index 131cee85cb..99c278b2d5 100644 --- a/src/gtk1/mdi.cpp +++ b/src/gtk1/mdi.cpp @@ -168,15 +168,18 @@ void wxMDIParentFrame::OnInternalIdle() GtkNotebook *notebook = GTK_NOTEBOOK(m_clientWindow->m_widget); gtk_notebook_set_page( notebook, g_list_length( notebook->children ) - 1 ); - /* need to set the menubar of the child */ + /* need to set the menubar of the child */ wxMDIChildFrame *active_child_frame = GetActiveChild(); wxMenuBar *menu_bar = active_child_frame->m_menuBar; - menu_bar->m_width = m_width; - menu_bar->m_height = wxMENU_HEIGHT; - gtk_pizza_set_size( GTK_PIZZA(m_mainWidget), - menu_bar->m_widget, - 0, 0, m_width, wxMENU_HEIGHT ); - menu_bar->SetInvokingWindow(active_child_frame); + if (menu_bar) + { + menu_bar->m_width = m_width; + menu_bar->m_height = wxMENU_HEIGHT; + 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; return; -- 2.45.2