[gtk+] Make gtk_tree_model_foreach robust
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Make gtk_tree_model_foreach robust
- Date: Tue, 9 Dec 2014 05:43:02 +0000 (UTC)
commit 1ed5bd07bbe61f8cff5ca122e94d90c8ec97075c
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Dec 9 00:41:11 2014 -0500
Make gtk_tree_model_foreach robust
Make gtk_tree_model_foreach safe for callbacks that modify
the model, even if the model does not have persistent iters.
https://bugzilla.gnome.org/show_bug.cgi?id=722781
gtk/gtktreemodel.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtktreemodel.c b/gtk/gtktreemodel.c
index 3906562..8bbf55d 100644
--- a/gtk/gtktreemodel.c
+++ b/gtk/gtktreemodel.c
@@ -1969,6 +1969,10 @@ gtk_tree_model_foreach_helper (GtkTreeModel *model,
GtkTreeModelForeachFunc func,
gpointer user_data)
{
+ gboolean iters_persist;
+
+ iters_persist = gtk_tree_model_get_flags (model) & GTK_TREE_MODEL_ITERS_PERSIST;
+
do
{
GtkTreeIter child;
@@ -1976,6 +1980,12 @@ gtk_tree_model_foreach_helper (GtkTreeModel *model,
if ((* func) (model, path, iter, user_data))
return TRUE;
+ if (!iters_persist)
+ {
+ if (!gtk_tree_model_get_iter (model, iter, path))
+ return TRUE;
+ }
+
if (gtk_tree_model_iter_children (model, &child, iter))
{
gtk_tree_path_down (path);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]