[glib] validate_and_install_property(): Validate presence of get/set_property methods last



commit 95f44b280fc5e36c23e5e67d50e86de1098bd39c
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon Sep 11 09:35:53 2017 -0500

    validate_and_install_property(): Validate presence of get/set_property methods last
    
    https://bugzilla.gnome.org/show_bug.cgi?id=787551

 gobject/gobject.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/gobject/gobject.c b/gobject/gobject.c
index bb46838..6546d1a 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -539,16 +539,17 @@ validate_and_install_class_property (GObjectClass *class,
 {
   g_return_val_if_fail (G_IS_PARAM_SPEC (pspec), FALSE);
   g_return_val_if_fail (pspec->flags & (G_PARAM_READABLE | G_PARAM_WRITABLE), FALSE);
-  if (pspec->flags & G_PARAM_WRITABLE)
-    g_return_val_if_fail (class->set_property != NULL, FALSE);
-  if (pspec->flags & G_PARAM_READABLE)
-    g_return_val_if_fail (class->get_property != NULL, FALSE);
   g_return_val_if_fail (PARAM_SPEC_PARAM_ID (pspec) == 0, FALSE);      /* paranoid */
   if (pspec->flags & G_PARAM_CONSTRUCT)
     g_return_val_if_fail ((pspec->flags & G_PARAM_CONSTRUCT_ONLY) == 0, FALSE);
   if (pspec->flags & (G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT_ONLY))
     g_return_val_if_fail (pspec->flags & G_PARAM_WRITABLE, FALSE);
 
+  if (pspec->flags & G_PARAM_WRITABLE)
+    g_return_val_if_fail (class->set_property != NULL, FALSE);
+  if (pspec->flags & G_PARAM_READABLE)
+    g_return_val_if_fail (class->get_property != NULL, FALSE);
+
   class->flags |= CLASS_HAS_PROPS_FLAG;
   if (install_property_internal (oclass_type, property_id, pspec))
     {


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