[gtk+/wip/native-file-chooser: 5/14] TreeModelFilter: Fix uninitialized memory read.



commit 1c46a02bcbfd70c1323e7dc661526b92e4487a27
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Oct 29 15:17:44 2015 +0100

    TreeModelFilter: Fix uninitialized memory read.
    
    We were copying an iterator that sometimes was not initialized,
    which caused debugger warnings in VS2015.

 gtk/gtktreemodelfilter.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtktreemodelfilter.c b/gtk/gtktreemodelfilter.c
index 01f3e17..7b77ef1 100644
--- a/gtk/gtktreemodelfilter.c
+++ b/gtk/gtktreemodelfilter.c
@@ -1357,20 +1357,20 @@ gtk_tree_model_filter_check_ancestors (GtkTreeModelFilter *filter,
   int *indices = gtk_tree_path_get_indices (path);
   FilterElt *elt;
   FilterLevel *level;
-  GtkTreeIter c_iter, tmp_iter;
+  GtkTreeIter c_iter, tmp_iter, *root_iter;
 
   level = FILTER_LEVEL (filter->priv->root);
 
   if (!level)
     return;
 
-  if (filter->priv->virtual_root)
-    gtk_tree_model_get_iter (filter->priv->child_model, &c_iter,
-                             filter->priv->virtual_root);
-
-  tmp_iter = c_iter;
+  root_iter = NULL;
+  if (filter->priv->virtual_root &&
+      gtk_tree_model_get_iter (filter->priv->child_model, &tmp_iter,
+                               filter->priv->virtual_root))
+    root_iter = &tmp_iter;
   gtk_tree_model_iter_nth_child (filter->priv->child_model, &c_iter,
-                                 filter->priv->virtual_root ? &tmp_iter : NULL,
+                                 root_iter,
                                  indices[i]);
 
   while (i < gtk_tree_path_get_depth (path) - 1)


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