From a8ad39466b19601b4284c2f4e6afa68eccb91b62 Mon Sep 17 00:00:00 2001 From: leo Date: Sat, 21 Feb 2009 08:59:00 +0000 Subject: Fixed crash when loading a project from the command line. git-svn-id: http://svn.leocad.org/tags/leocad-0.75@740 c7d43263-9d01-0410-8a33-9dba5d9f93d6 --- linux/basewnd.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'linux') diff --git a/linux/basewnd.cpp b/linux/basewnd.cpp index 5593062..8c4260b 100644 --- a/linux/basewnd.cpp +++ b/linux/basewnd.cpp @@ -11,6 +11,7 @@ BaseWnd::BaseWnd (BaseWnd *parent, int menu_count) { m_pMenuItems = new BaseMenuItem[menu_count]; + memset(m_pMenuItems, 0, sizeof(BaseMenuItem[menu_count])); m_pParent = parent; m_pXID = gtk_window_new (GTK_WINDOW_TOPLEVEL); @@ -168,6 +169,9 @@ int BaseWnd::MessageBox (const char* text, const char* caption, int flags) void BaseWnd::ShowMenuItem (int id, bool show) { + if (!m_pMenuItems[id].widget) + return; + if (show) gtk_widget_show (m_pMenuItems[id].widget); else @@ -176,11 +180,17 @@ void BaseWnd::ShowMenuItem (int id, bool show) void BaseWnd::EnableMenuItem (int id, bool enable) { + if (!m_pMenuItems[id].widget) + return; + gtk_widget_set_sensitive (m_pMenuItems[id].widget, enable); } void BaseWnd::CheckMenuItem (int id, bool check) { + if (!m_pMenuItems[id].widget) + return; + ignore_commands = true; gtk_check_menu_item_set_state (GTK_CHECK_MENU_ITEM (m_pMenuItems[id].widget), check); ignore_commands = false; @@ -195,6 +205,9 @@ void BaseWnd::SetMenuItemText (int id, const char *text) gchar *pattern; gint length; + if (!m_pMenuItems[id].widget) + return; + length = strlen (text); pattern = g_new (gchar, length+1); -- cgit v1.2.3