[glib/wip/nielsdg/install-properties-single] gobject: Allow install_properties with 1 GParamSpec



commit e12893754e162ce5028150776eb60b8b54db2e2b
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Tue Oct 29 12:30:47 2019 +0100

    gobject: Allow install_properties with 1 GParamSpec
    
    `g_object_install_properties()` can be used to install multiple
    properties at once, _and_ to allow an optimization for property
    notification. Arguably, using it over `g_object_install_property()` is
    best practice. That being said, you can't use it if you have only a
    single property that is installed (yet), due to a precondition check for
    more than 1 pspecs.

 gobject/gobject.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gobject/gobject.c b/gobject/gobject.c
index df27c36f7..e470c6888 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -729,7 +729,7 @@ g_object_class_install_properties (GObjectClass  *oclass,
   gint i;
 
   g_return_if_fail (G_IS_OBJECT_CLASS (oclass));
-  g_return_if_fail (n_pspecs > 1);
+  g_return_if_fail (n_pspecs >= 1);
   g_return_if_fail (pspecs[0] == NULL);
 
   if (CLASS_HAS_DERIVED_CLASS (oclass))


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