[glib: 2/2] Merge branch 'gobject-speedup8' into 'main'




commit b1e371034dd5e28e953df13fdbe391c1989820b9
Merge: 5de59d34e1 9d7d439607
Author: Philip Withnall <philip tecnocode co uk>
Date:   Tue Jun 7 11:45:25 2022 +0000

    Merge branch 'gobject-speedup8' into 'main'
    
    Avoid g_param_spec_get_redirect_target
    
    See merge request GNOME/glib!2722

 gobject/gobject.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)
---
diff --cc gobject/gobject.c
index 06719b606a,8477e8fa13..dfdb14d7c2
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@@ -1564,21 -1550,17 +1568,18 @@@ object_get_property (GObject     *objec
                     GParamSpec  *pspec,
                     GValue      *value)
  {
 -  GObjectClass *class = g_type_class_peek (pspec->owner_type);
 +  GTypeInstance *inst = (GTypeInstance *) object;
 +  GObjectClass *class;
    guint param_id = PARAM_SPEC_PARAM_ID (pspec);
-   GParamSpec *redirect;
  
 -  if (class == NULL)
 -    {
 -      g_warning ("'%s::%s' is not a valid property name; '%s' is not a GObject subtype",
 -                 g_type_name (pspec->owner_type), pspec->name, g_type_name (pspec->owner_type));
 -      return;
 -    }
 +  if (G_LIKELY (inst->g_class->g_type == pspec->owner_type))
 +    class = (GObjectClass *) inst->g_class;
 +  else
 +    class = g_type_class_peek (pspec->owner_type);
 +
 +  g_assert (class != NULL);
  
-   redirect = g_param_spec_get_redirect_target (pspec);
-   if (redirect)
-     pspec = redirect;
+   param_spec_follow_override (&pspec);
  
    consider_issuing_property_deprecation_warning (pspec);
  
@@@ -1591,25 -1573,19 +1592,22 @@@ object_set_property (GObjec
                     const GValue        *value,
                     GObjectNotifyQueue  *nqueue)
  {
 -  GObjectClass *class = g_type_class_peek (pspec->owner_type);
 +  GTypeInstance *inst = (GTypeInstance *) object;
 +  GObjectClass *class;
    GParamSpecClass *pclass;
    guint param_id = PARAM_SPEC_PARAM_ID (pspec);
-   GParamSpec *redirect;
  
 -  if (G_UNLIKELY (class == NULL))
 -    {
 -      g_warning ("'%s::%s' is not a valid property name; '%s' is not a GObject subtype",
 -                 g_type_name (pspec->owner_type), pspec->name, g_type_name (pspec->owner_type));
 -      return;
 -    }
 +  if (G_LIKELY (inst->g_class->g_type == pspec->owner_type))
 +    class = (GObjectClass *) inst->g_class;
 +  else
 +    class = g_type_class_peek (pspec->owner_type);
 +
 +  g_assert (class != NULL);
  
-   redirect = g_param_spec_get_redirect_target (pspec);
-   if (redirect)
-     pspec = redirect;
+   param_spec_follow_override (&pspec);
  
 +  consider_issuing_property_deprecation_warning (pspec);
 +
    pclass = G_PARAM_SPEC_GET_CLASS (pspec);
    if (g_value_type_compatible (G_VALUE_TYPE (value), pspec->value_type) &&
        (pclass->value_validate == NULL ||


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