Backported from GNOME #351814; workaround for a crash in the bookmark-editor.

2007-01-08  Diego Escalante Urrelo <diegoe@svn.gnome.org>

       * src/bookmarks/ephy-bookmarks-editor.c:
       * lib/widgets/ephy-node-view.c:

       Workaround/semi-fix for bug #351814. The real cause of the problem is
       the user_data that is never set on a GtkTreeIter, so the Ephy
       implementation of the tree makes it to have a stamp of 0 being that
       way an invalid iter. Patch by Diego Escalante Urrelo.

diff -Nur epiphany-browser-2.14.3/lib/widgets/ephy-node-view.c epiphany-browser-2.14.3.new/lib/widgets/ephy-node-view.c
--- epiphany-browser-2.14.3/lib/widgets/ephy-node-view.c	2006-07-10 22:44:25.000000000 +0200
+++ epiphany-browser-2.14.3.new/lib/widgets/ephy-node-view.c	2007-02-26 11:21:35.000000000 +0100
@@ -159,16 +159,21 @@
 get_node_from_path (EphyNodeView *view, GtkTreePath *path)
 {
 	EphyNode *node;
-	GtkTreeIter iter, iter2;
+	GtkTreeIter iter, iter2, iter3;
 
 	if (path == NULL) return NULL;
 
 	gtk_tree_model_get_iter (view->priv->sortmodel, &iter, path);
 	gtk_tree_model_sort_convert_iter_to_child_iter
 		(GTK_TREE_MODEL_SORT (view->priv->sortmodel), &iter2, &iter);
+
+	if (iter2.stamp == 0) {
+		return NULL;
+	}
 	gtk_tree_model_filter_convert_iter_to_child_iter
-		(GTK_TREE_MODEL_FILTER (view->priv->filtermodel), &iter, &iter2);
-	node = ephy_tree_model_node_node_from_iter (view->priv->nodemodel, &iter);
+		(GTK_TREE_MODEL_FILTER (view->priv->filtermodel), &iter3, &iter2);
+
+	node = ephy_tree_model_node_node_from_iter (view->priv->nodemodel, &iter3);
 
 	return node;
 }
@@ -1377,7 +1382,7 @@
 	EphyNodeViewPrivate *priv = view->priv;
 	GList *list, *l;
 	EphyNode *node;
-	GtkTreeIter iter, iter2;
+	GtkTreeIter iter, iter2, iter3;
 	GtkTreePath *path;
 	GtkTreeRowReference *row_ref = NULL;
 	GtkTreeSelection *selection;
@@ -1392,9 +1397,9 @@
 
 	node = g_list_first (list)->data;
 	ephy_tree_model_node_iter_from_node (EPHY_TREE_MODEL_NODE (view->priv->nodemodel),
-					     node, &iter);
+					     node, &iter3);
 	gtk_tree_model_filter_convert_child_iter_to_iter (GTK_TREE_MODEL_FILTER (view->priv->filtermodel),
-							  &iter2, &iter);
+							  &iter2, &iter3);
 	gtk_tree_model_sort_convert_child_iter_to_iter (GTK_TREE_MODEL_SORT (view->priv->sortmodel),
 							&iter, &iter2);
 	iter2 = iter;
diff -Nur epiphany-browser-2.14.3/src/bookmarks/ephy-bookmarks-editor.c epiphany-browser-2.14.3.new/src/bookmarks/ephy-bookmarks-editor.c
--- epiphany-browser-2.14.3/src/bookmarks/ephy-bookmarks-editor.c	2006-04-03 15:31:04.000000000 +0200
+++ epiphany-browser-2.14.3.new/src/bookmarks/ephy-bookmarks-editor.c	2007-02-26 11:21:35.000000000 +0100
@@ -1362,7 +1362,7 @@
 		EphyNode *node = selected->data;
 		char name[EPHY_BOOKMARK_ACTION_NAME_BUFFER_SIZE];
 
-		g_return_if_fail (node != NULL);
+		if (node == NULL) return;
 
 		mutable = !ephy_node_get_property_boolean (node, EPHY_NODE_BMK_PROP_IMMUTABLE);
 		
