diff options
-rw-r--r-- | shell/ChangeLog | 9 | ||||
-rw-r--r-- | shell/e-shell-user-creatable-items-handler.c | 42 |
2 files changed, 35 insertions, 16 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 59d6e116c5..b059c622a1 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,5 +1,14 @@ 2001-08-10 Ettore Perazzoli <ettore@ximian.com> + * e-shell-user-creatable-items-handler.c (component_free): Only + free the `type_list' if not NULL. + (setup_menu_xml): Deal with the case of `type_list' being NULL + gracefully. + (verb_fn): Same here. + (add_verbs_to_ui_component): Likewise. + +2001-08-10 Ettore Perazzoli <ettore@ximian.com> + [Fix #6787, Removing a storage with children and then re-adding it causes a crash.] diff --git a/shell/e-shell-user-creatable-items-handler.c b/shell/e-shell-user-creatable-items-handler.c index 6be8942a5d..ed8f727f41 100644 --- a/shell/e-shell-user-creatable-items-handler.c +++ b/shell/e-shell-user-creatable-items-handler.c @@ -87,7 +87,9 @@ static void component_free (Component *component) { gtk_object_unref (GTK_OBJECT (component->component_client)); - CORBA_free (component->type_list); + + if (component->type_list != NULL) + CORBA_free (component->type_list); g_free (component); } @@ -214,18 +216,20 @@ setup_menu_xml (EShellUserCreatableItemsHandler *handler) int i; component = (const Component *) p->data; - for (i = 0; i < component->type_list->_length; i ++) { - const GNOME_Evolution_UserCreatableItemType *type; - MenuItem *item; + if (component->type_list != NULL) { + for (i = 0; i < component->type_list->_length; i ++) { + const GNOME_Evolution_UserCreatableItemType *type; + MenuItem *item; - type = (const GNOME_Evolution_UserCreatableItemType *) component->type_list->_buffer + i; + type = (const GNOME_Evolution_UserCreatableItemType *) component->type_list->_buffer + i; - item = g_new (MenuItem, 1); - item->label = type->menuDescription; - item->shortcut = type->menuShortcut; - item->verb = create_verb_from_component_number_and_type_id (component_num, type->id); + item = g_new (MenuItem, 1); + item->label = type->menuDescription; + item->shortcut = type->menuShortcut; + item->verb = create_verb_from_component_number_and_type_id (component_num, type->id); - menu_items = g_slist_prepend (menu_items, item); + menu_items = g_slist_prepend (menu_items, item); + } } component_num ++; @@ -287,6 +291,9 @@ verb_fn (BonoboUIComponent *ui_component, component = (const Component *) component_list_item->data; + if (component->type_list == NULL) + return; + for (i = 0; i < component->type_list->_length; i ++) { if (strcmp (component->type_list->_buffer[i].id, id) == 0) { CORBA_Environment ev; @@ -325,15 +332,18 @@ add_verbs_to_ui_component (EShellUserCreatableItemsHandler *handler, int i; component = (const Component *) p->data; - for (i = 0; i < component->type_list->_length; i ++) { - char *verb_name; - verb_name = create_verb_from_component_number_and_type_id (component_num, - component->type_list->_buffer[i].id); + if (component->type_list != NULL) { + for (i = 0; i < component->type_list->_length; i ++) { + char *verb_name; + + verb_name = create_verb_from_component_number_and_type_id + (component_num, component->type_list->_buffer[i].id); - bonobo_ui_component_add_verb (ui_component, verb_name, verb_fn, handler); + bonobo_ui_component_add_verb (ui_component, verb_name, verb_fn, handler); - g_free (verb_name); + g_free (verb_name); + } } component_num ++; |