[template-glib] iterator: improve GListModel check



commit a118f44ab991eb5fff218a23dc33cf2d5d401477
Author: Christian Hergert <chergert redhat com>
Date:   Mon Oct 23 14:41:19 2017 -0700

    iterator: improve GListModel check
    
    We cannot rely on the specified type in the GValue, but instead
    the type of the object contained.

 src/tmpl-iterator.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/tmpl-iterator.c b/src/tmpl-iterator.c
index 4c1c897..04252e8 100644
--- a/src/tmpl-iterator.c
+++ b/src/tmpl-iterator.c
@@ -110,7 +110,8 @@ tmpl_iterator_init (TmplIterator *iter,
       iter->get_value = string_get_value;
       iter->destroy = NULL;
     }
-  else if (G_VALUE_HOLDS (value, G_TYPE_LIST_MODEL))
+  else if (G_VALUE_HOLDS (value, G_TYPE_OBJECT) &&
+           G_IS_LIST_MODEL (g_value_get_object (value)))
     {
       iter->instance = g_value_get_object (value);
       iter->move_next = list_model_move_next;


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