[grilo] core: Fix excessive ref'ing when registering new keys



commit d3a2c277d9d2af9b5aaedbf94f6481ba98ccff3b
Author: Bastien Nocera <hadess hadess net>
Date:   Sun Nov 30 18:58:46 2014 +0100

    core: Fix excessive ref'ing when registering new keys
    
    When registering new metadata keys, there's no need to take a new
    reference to the GParamSpec passed, as the usual construct is to
    call g_param_spec_new_... in the call to
    grl_registry_register_metadata_key(), leaking the original reference
    to the GParamSpec when grilo it de-inited.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=740942

 src/grl-registry.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/src/grl-registry.c b/src/grl-registry.c
index 017e625..57b68cf 100644
--- a/src/grl-registry.c
+++ b/src/grl-registry.c
@@ -559,7 +559,7 @@ grl_registry_register_metadata_key_full (GrlRegistry *registry,
 
   g_hash_table_insert (registry->priv->system_keys,
                        (gpointer) key_name,
-                       g_param_spec_ref (param_spec));
+                       param_spec);
 
   /* Each key is related to itself */
   g_hash_table_insert (registry->priv->related_keys,
@@ -1386,7 +1386,7 @@ grl_registry_unload_plugin (GrlRegistry *registry,
 /**
  * grl_registry_register_metadata_key:
  * @registry: The plugin registry
- * @param_spec: The definition of the key to register
+ * @param_spec: (transfer full): The definition of the key to register
  * @error: error return location or @NULL to ignore
  *
  * Registers a metadata key
@@ -1437,7 +1437,6 @@ grl_registry_register_metadata_key_system (GrlRegistry *registry,
                                                             param_spec,
                                                             key,
                                                             error);
-  g_param_spec_unref (param_spec);
 
   return registered_key;
 }


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