summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorleo2009-02-21 08:59:00 +0000
committerleo2009-02-21 08:59:00 +0000
commita8ad39466b19601b4284c2f4e6afa68eccb91b62 (patch)
tree62825c3e841a668ee2750b13dda838de6d19cfe6 /linux
parentb70caee2a4d6e0a7c04e7442e8a13f22c9b27e56 (diff)
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
Diffstat (limited to 'linux')
-rw-r--r--linux/basewnd.cpp13
1 files changed, 13 insertions, 0 deletions
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);