[gtk/gtk-4-4] builder: Don't leak refs



commit 161259e9ea43d9bbbda19ecfe290a8e47288c47a
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Sep 27 16:38:32 2021 -0400

    builder: Don't leak refs
    
    We sometimes end up setting an object on a GValue
    that we are then not interested in. We need to
    unset it, or we'll leak the ref.

 gtk/gtkbuilder.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkbuilder.c b/gtk/gtkbuilder.c
index 9d85e6f2ed..81d4509256 100644
--- a/gtk/gtkbuilder.c
+++ b/gtk/gtkbuilder.c
@@ -617,16 +617,12 @@ gtk_builder_get_parameters (GtkBuilder         *builder,
           continue;
         }
 
-      if (prop->pspec->flags & filter_flags)
-        {
-          if (filtered_parameters)
-            object_properties_add (filtered_parameters, property_name, &property_value);
-        }
+      if ((prop->pspec->flags & filter_flags) != 0 && filtered_parameters)
+        object_properties_add (filtered_parameters, property_name, &property_value);
+      else if ((prop->pspec->flags & filter_flags) == 0 && parameters)
+        object_properties_add (parameters, property_name, &property_value);
       else
-        {
-          if (parameters)
-            object_properties_add (parameters, property_name, &property_value);
-        }
+        g_value_unset (&property_value);
     }
 }
 


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