[Xfce4-commits] r23625 - in thunar/trunk: . thunar

Benedikt Meurer benny at xfce.org
Sat Nov 4 01:13:44 CET 2006


Author: benny
Date: 2006-11-04 00:13:40 +0000 (Sat, 04 Nov 2006)
New Revision: 23625

Modified:
   thunar/trunk/ChangeLog
   thunar/trunk/thunar/thunar-tree-model.c
Log:
2006-11-04	Benedikt Meurer <benny at xfce.org>

	* thunar/thunar-tree-model.c(thunar_tree_model_item_files_removed):
	  The "row-has-child-toggled" signal must not be emitted if the
	  children of the row did not change, otherwise newer GtkTreeView's
	  will loose sync with the model and probably crash. Bug #2372.




Modified: thunar/trunk/ChangeLog
===================================================================
--- thunar/trunk/ChangeLog	2006-11-03 23:13:03 UTC (rev 23624)
+++ thunar/trunk/ChangeLog	2006-11-04 00:13:40 UTC (rev 23625)
@@ -1,5 +1,12 @@
 2006-11-04	Benedikt Meurer <benny at xfce.org>
 
+	* thunar/thunar-tree-model.c(thunar_tree_model_item_files_removed):
+	  The "row-has-child-toggled" signal must not be emitted if the
+	  children of the row did not change, otherwise newer GtkTreeView's
+	  will loose sync with the model and probably crash. Bug #2372.
+
+2006-11-04	Benedikt Meurer <benny at xfce.org>
+
 	* thunar/thunar-location-entry.c: Merge drop-down menu making shortcuts
 	  accessible even if the classic file manager look'n'feel is being
 	  used. Bug #2024.

Modified: thunar/trunk/thunar/thunar-tree-model.c
===================================================================
--- thunar/trunk/thunar/thunar-tree-model.c	2006-11-03 23:13:03 UTC (rev 23624)
+++ thunar/trunk/thunar/thunar-tree-model.c	2006-11-04 00:13:40 UTC (rev 23625)
@@ -1367,27 +1367,35 @@
   /* determine the node for the folder */
   node = g_node_find (model->root, G_POST_ORDER, G_TRAVERSE_ALL, item);
 
-  /* process all files */
-  for (lp = files; lp != NULL; lp = lp->next)
+  /* check if the node has any visible children */
+  if (G_LIKELY (node->children != NULL))
     {
-      /* find the child node for the file */
-      for (child_node = g_node_first_child (node); child_node != NULL; child_node = g_node_next_sibling (child_node))
-        if (child_node->data != NULL && THUNAR_TREE_MODEL_ITEM (child_node->data)->file == lp->data)
-          break;
+      /* process all files */
+      for (lp = files; lp != NULL; lp = lp->next)
+        {
+          /* find the child node for the file */
+          for (child_node = g_node_first_child (node); child_node != NULL; child_node = g_node_next_sibling (child_node))
+            if (child_node->data != NULL && THUNAR_TREE_MODEL_ITEM (child_node->data)->file == lp->data)
+              break;
 
-      /* drop the child node (and all descendant nodes) from the model */
-      if (G_LIKELY (child_node != NULL))
-        g_node_traverse (child_node, G_POST_ORDER, G_TRAVERSE_ALL, -1, thunar_tree_model_node_traverse_remove, model);
-    }
+          /* drop the child node (and all descendant nodes) from the model */
+          if (G_LIKELY (child_node != NULL))
+            g_node_traverse (child_node, G_POST_ORDER, G_TRAVERSE_ALL, -1, thunar_tree_model_node_traverse_remove, model);
+        }
 
-  /* determine the iterator for the folder node */
-  iter.stamp = model->stamp;
-  iter.user_data = node;
+      /* check if all children of the node where dropped */
+      if (G_UNLIKELY (node->children == NULL))
+        {
+          /* determine the iterator for the folder node */
+          iter.stamp = model->stamp;
+          iter.user_data = node;
 
-  /* emit "row-has-child-toggled" for the folder node */
-  path = gtk_tree_model_get_path (GTK_TREE_MODEL (model), &iter);
-  gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (model), path, &iter);
-  gtk_tree_path_free (path);
+          /* emit "row-has-child-toggled" for the folder node */
+          path = gtk_tree_model_get_path (GTK_TREE_MODEL (model), &iter);
+          gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (model), path, &iter);
+          gtk_tree_path_free (path);
+        }
+    }
 }
 
 



More information about the Xfce4-commits mailing list