[glib/g-property: 15/22] gproperty: Add an additional type check



commit aa7ea010a14e80d7dbf05893d541aad257cdf200
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Mon Jul 4 15:31:02 2011 +0100

    gproperty: Add an additional type check
    
    Make sure to get out of the auto-generated accessors if we're trying to
    use them with properties not defined using GProperty.

 gobject/gproperty.h |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/gobject/gproperty.h b/gobject/gproperty.h
index 3b73106..abb0137 100644
--- a/gobject/gproperty.h
+++ b/gobject/gproperty.h
@@ -405,6 +405,12 @@ GParamSpec *    g_pointer_property_new  (const gchar         *name,
       } \
   } \
 \
+  if (!G_IS_PROPERTY (g_property)) \
+    { \
+      g_critical (G_STRLOC ": Property " #f_n " is not a GProperty"); \
+      return (f_t) 0; \
+    } \
+\
   if (!g_property_is_readable (g_property)) \
     { \
        g_critical (G_STRLOC ": The property " #f_n " is not readable"); \
@@ -444,6 +450,12 @@ GParamSpec *    g_pointer_property_new  (const gchar         *name,
       } \
   } \
 \
+  if (!G_IS_PROPERTY (g_property)) \
+    { \
+      g_critical (G_STRLOC ": Property " #f_n " is not a GProperty"); \
+      return; \
+    } \
+\
   if (!g_property_is_writable (g_property)) \
     { \
        g_critical (G_STRLOC ": The property " #f_n " is not writable"); \



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