aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2001-08-10 13:22:02 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2001-08-10 13:22:02 +0800
commit513bfe0292c1721708e83617a8b19db3574060fb (patch)
tree1854d1c349e68804072be7530f74a2074853fd3c
parent2bd1cd5f39f24b1e513e9b2c5730132e7f38d2f8 (diff)
downloadgsoc2013-evolution-513bfe0292c1721708e83617a8b19db3574060fb.tar.gz
gsoc2013-evolution-513bfe0292c1721708e83617a8b19db3574060fb.tar.zst
gsoc2013-evolution-513bfe0292c1721708e83617a8b19db3574060fb.zip
Only free the `type_list' if not NULL. (setup_menu_xml): Deal with the
* 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. svn path=/trunk/; revision=11873
-rw-r--r--shell/ChangeLog9
-rw-r--r--shell/e-shell-user-creatable-items-handler.c42
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 ++;