Index: widgets/table/e-tree-table-adapter.c
===================================================================
--- widgets/table/e-tree-table-adapter.c	(revision 34086)
+++ widgets/table/e-tree-table-adapter.c	(working copy)
@@ -80,6 +80,8 @@
 	int          node_removed_id;
 	int          node_request_collapse_id;
 	int          sort_info_changed_id;
+
+	guint        resort_idle_id;
 };
 
 static void etta_sort_info_changed (ETableSortInfo *sort_info, ETreeTableAdapter *etta);
@@ -498,6 +500,11 @@
 {
 	ETreeTableAdapter *etta = E_TREE_TABLE_ADAPTER (object);
 
+	if (etta->priv->resort_idle_id) {
+		g_source_remove (etta->priv->resort_idle_id);
+		etta->priv->resort_idle_id = 0;
+	}
+
 	if (etta->priv->root) {
 		kill_gnode(etta->priv->root, etta);
 		etta->priv->root = NULL;
@@ -728,6 +735,8 @@
 	etta->priv->node_inserted_id         = 0;
 	etta->priv->node_removed_id          = 0;
 	etta->priv->node_request_collapse_id = 0;
+
+	etta->priv->resort_idle_id           = 0;
 }
 
 static void
@@ -746,6 +755,7 @@
 resort_model (ETreeTableAdapter *etta)
 {
 	etta_sort_info_changed (NULL, etta);
+	etta->priv->resort_idle_id = 0;
 	return FALSE;
 }
 
@@ -758,7 +768,8 @@
 	/* FIXME: Really it shouldnt be required. But a lot of thread
 	 * which were supposed to be present in the list is way below
 	 */
-	g_idle_add ((GSourceFunc) resort_model, etta);
+	if (!etta->priv->resort_idle_id)
+		etta->priv->resort_idle_id = g_idle_add ((GSourceFunc) resort_model, etta);
 }
 
 static void
Index: widgets/table/ChangeLog
===================================================================
--- widgets/table/ChangeLog	(revision 34086)
+++ widgets/table/ChangeLog	(working copy)
@@ -1,3 +1,14 @@
+2007-08-24  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #239441
+
+	* e-tree-table-adapter.c: (struct ETreeTableAdapterPriv),
+	(etta_finalize), (etta_init), (resort_model),
+	(etta_proxy_node_changed):
+	Remember resort_idle_id and remove it from g_source when
+	finalizing structure, so it will not be called when the
+	structure itself is already freed.
+
 2007-08-23  Matthew Barnes  <mbarnes@redhat.com>
 
 	** Fixes bug #303877.
