From 12347daf568506538abf8f63c54c2699e8e8d383 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Thu, 18 Jan 2001 16:42:33 +0000 Subject: Disconnect from the etss->source's signals *before* we unref it. 2001-01-18 Federico Mena Quintero * e-table-subset.c (etss_destroy): Disconnect from the etss->source's signals *before* we unref it. * e-table-group-container.c (e_table_group_apply_to_leafs): Ref() and unref() around the callback to protect ourselves from being unrefed in the middle of iterating through the nodes. svn path=/trunk/; revision=7621 --- widgets/table/e-table-group-container.c | 5 +++++ widgets/table/e-table-subset.c | 27 +++++++++++++++++---------- 2 files changed, 22 insertions(+), 10 deletions(-) (limited to 'widgets/table') diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c index ff5b1087b2..4327c2f94e 100644 --- a/widgets/table/e-table-group-container.c +++ b/widgets/table/e-table-group-container.c @@ -826,11 +826,16 @@ e_table_group_apply_to_leafs (ETableGroup *etg, ETableGroupLeafFn fn, void *clos ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (etg); GList *list = etgc->children; + /* Protect from unrefs in the callback functions */ + gtk_object_ref (GTK_OBJECT (etg)); + for (list = etgc->children; list; list = list->next){ ETableGroupContainerChildNode *child_node = list->data; e_table_group_apply_to_leafs (child_node->child, fn, closure); } + + gtk_object_unref (GTK_OBJECT (etg)); } else if (E_IS_TABLE_GROUP_LEAF (etg)){ (*fn) (E_TABLE_GROUP_LEAF (etg)->item, closure); } else { diff --git a/widgets/table/e-table-subset.c b/widgets/table/e-table-subset.c index 0eee187271..88ec8e59f4 100644 --- a/widgets/table/e-table-subset.c +++ b/widgets/table/e-table-subset.c @@ -23,17 +23,24 @@ etss_destroy (GtkObject *object) { ETableSubset *etss = E_TABLE_SUBSET (object); - if (etss->source) - gtk_object_unref (GTK_OBJECT (etss->source)); + if (etss->source) { + gtk_signal_disconnect (GTK_OBJECT (etss->source), + etss->table_model_pre_change_id); + gtk_signal_disconnect (GTK_OBJECT (etss->source), + etss->table_model_changed_id); + gtk_signal_disconnect (GTK_OBJECT (etss->source), + etss->table_model_row_changed_id); + gtk_signal_disconnect (GTK_OBJECT (etss->source), + etss->table_model_cell_changed_id); + + etss->table_model_pre_change_id = 0; + etss->table_model_changed_id = 0; + etss->table_model_row_changed_id = 0; + etss->table_model_cell_changed_id = 0; - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etss->table_model_pre_change_id); - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etss->table_model_changed_id); - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etss->table_model_row_changed_id); - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etss->table_model_cell_changed_id); + gtk_object_unref (GTK_OBJECT (etss->source)); + etss->source = NULL; + } etss->table_model_pre_change_id = 0; etss->table_model_changed_id = 0; -- cgit