[glib/fix-param-validation] Fix g_param_is_valid for GParam




commit c4542ca596ec734ebd0f63cbe48bce13f5197acf
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Sep 24 20:21:07 2022 -0400

    Fix g_param_is_valid for GParam
    
    The is_valid vfunc need to return the same
    condition that the validate vfunc uses to
    determine whether to 'fix' the value.
    
    param_param_validate is considering NULL to
    be a valid value, so param_param_is_valid needs
    to do the same.
    
    Fixes: #8576

 gobject/gparamspecs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gobject/gparamspecs.c b/gobject/gparamspecs.c
index f17b3488b9..c3e4e446aa 100644
--- a/gobject/gparamspecs.c
+++ b/gobject/gparamspecs.c
@@ -894,7 +894,7 @@ param_param_is_valid (GParamSpec   *pspec,
 {
   GParamSpec *param = value->data[0].v_pointer;
 
-  return g_value_type_compatible (G_PARAM_SPEC_TYPE (param), G_PARAM_SPEC_VALUE_TYPE (pspec));
+  return !param || g_value_type_compatible (G_PARAM_SPEC_TYPE (param), G_PARAM_SPEC_VALUE_TYPE (pspec));
 }
 
 static gboolean


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