From dc71d29b62b057d2fa82cb6fb007d8f930b9db3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 16 Apr 2008 13:16:44 +0000 Subject: [PATCH] gst/gstregistrybinary.c: If an element supports the Uri interface, returns a valid pointer to the supported URI proto... Original commit message from CVS: * gst/gstregistrybinary.c: (gst_registry_binary_save_feature), (gst_registry_binary_load_feature), (gst_registry_binary_load_plugin): If an element supports the Uri interface, returns a valid pointer to the supported URI protocols but this pointer contains nothing don't try to save that as it will corrupt the registry. Don't unref the plugin if we added it to the registry already but fail to load a feature as gst_registry_add_plugin() takes ownership of the plugin. Improve debugging a bit. --- ChangeLog | 15 +++++++++++++++ gst/gstregistrybinary.c | 8 +++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index e047c48e4e..3c018ace4d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2008-04-16 Sebastian Dröge + + * gst/gstregistrybinary.c: (gst_registry_binary_save_feature), + (gst_registry_binary_load_feature), + (gst_registry_binary_load_plugin): + If an element supports the Uri interface, returns a valid pointer + to the supported URI protocols but this pointer contains nothing + don't try to save that as it will corrupt the registry. + + Don't unref the plugin if we added it to the registry already but + fail to load a feature as gst_registry_add_plugin() takes ownership + of the plugin. + + Improve debugging a bit. + 2008-04-16 Stefan Kost * gst/gsttaglist.h: diff --git a/gst/gstregistrybinary.c b/gst/gstregistrybinary.c index e7d09cbd22..aeecd29232 100644 --- a/gst/gstregistrybinary.c +++ b/gst/gstregistrybinary.c @@ -280,7 +280,7 @@ gst_registry_binary_save_feature (GList ** list, GstPluginFeature * feature) GST_DEBUG ("Saved %d Interfaces", ef->ninterfaces); /* save uritypes */ if (GST_URI_TYPE_IS_VALID (factory->uri_type)) { - if (factory->uri_protocols) { + if (factory->uri_protocols && *factory->uri_protocols) { GstBinaryChunk *subchk; gchar **protocol; @@ -681,8 +681,10 @@ gst_registry_binary_load_feature (GstRegistry * registry, gchar ** in, /* unpack plugin feature strings */ unpack_string (*in, type_name); - if (!type_name || !*(type_name)) + if (!type_name || !*(type_name)) { + GST_ERROR ("No feature type name"); return FALSE; + } GST_DEBUG ("Plugin '%s' feature typename : '%s'", plugin_name, type_name); @@ -858,6 +860,7 @@ gst_registry_binary_load_plugin (GstRegistry * registry, gchar ** in) plugin->basename = g_path_get_basename (plugin->filename); + /* Takes ownership of plugin */ gst_registry_add_plugin (registry, plugin); GST_INFO ("Added plugin '%s' plugin with %d features from binary registry", plugin->desc.name, pe->nfeatures); @@ -872,7 +875,6 @@ gst_registry_binary_load_plugin (GstRegistry * registry, gchar ** in) /* Errors */ fail: - gst_object_unref (plugin); return FALSE; }