gossip r2766 - in trunk: . src



Author: mr
Date: Wed Mar 12 17:59:27 2008
New Revision: 2766
URL: http://svn.gnome.org/viewvc/gossip?rev=2766&view=rev

Log:
Fixed a crasher where we try to get the path of a parent iter that
isn't set


Modified:
   trunk/ChangeLog
   trunk/src/gossip-contact-list.c

Modified: trunk/src/gossip-contact-list.c
==============================================================================
--- trunk/src/gossip-contact-list.c	(original)
+++ trunk/src/gossip-contact-list.c	Wed Mar 12 17:59:27 2008
@@ -1589,31 +1589,38 @@
 		
 		for (l = iters; l; l = l->next) {
 			GtkTreeIter parent_iter;
+			gboolean    has_parent;
 			
 			/* NOTE: it is only <= 2 here because we have
 			 * separators after the group name, otherwise it
 			 * should be 1. 
 			 */
-			if (gtk_tree_model_iter_parent (model, &parent_iter, l->data) &&
-			    gtk_tree_model_iter_n_children (model, &parent_iter) <= 2) {
-				gtk_tree_store_remove (priv->store, &parent_iter);
-			} else {
+			has_parent = gtk_tree_model_iter_parent (model, &parent_iter, l->data);
+
+			if (has_parent) {
 				GtkTreePath *parent_path = NULL;
+				gint         children;
 
-				gtk_tree_store_remove (priv->store, l->data);
-				
-				/* To make sure the parent is hidden
-				 * correctly if we now have no more
-				 * online contacts, we emit the
-				 * row-changed signal on the parent so
-				 * it prompts it to be refreshed by
-				 * the filter func.  
-				 */
-				parent_path = gtk_tree_model_get_path (model, &parent_iter);
-				if (parent_path) {
-					gtk_tree_model_row_changed (model, parent_path, &parent_iter);
-					gtk_tree_path_free (parent_path);
+				children = gtk_tree_model_iter_n_children (model, &parent_iter);
+
+				if (children <= 2) {
+					gtk_tree_store_remove (priv->store, &parent_iter);
+				} else {
+					/* To make sure the parent is hidden
+					 * correctly if we now have no more
+					 * online contacts, we emit the
+					 * row-changed signal on the parent so
+					 * it prompts it to be refreshed by
+					 * the filter func.  
+					 */
+					parent_path = gtk_tree_model_get_path (model, &parent_iter);
+					if (parent_path) {
+						gtk_tree_model_row_changed (model, parent_path, &parent_iter);
+						gtk_tree_path_free (parent_path);
+					}
 				}
+			} else {
+				gtk_tree_store_remove (priv->store, l->data);
 			}
 		}
 		



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]