registry: when removing a cached-but-no-longer-existing plugin, only remove features that belong to it

When a plugin file no longer exists, e.g. because it's been removed or
renamed, don't remove all features in the registry based on the *name*
of the plugin they belong to, but only remove those who actually belong
to that particular plugin (object/pointer).

This fixes issues of plugin features disappearing when a plugin .so file
is renamed.

https://bugzilla.gnome.org/show_bug.cgi?id=604094
This commit is contained in:
Tim-Philipp Müller 2011-04-24 09:58:53 +01:00
parent 4926ce31c7
commit f9625dbe55

View file

@ -468,22 +468,20 @@ gst_registry_remove_features_for_plugin_unlocked (GstRegistry * registry,
GstPlugin * plugin) GstPlugin * plugin)
{ {
GList *f; GList *f;
const gchar *name;
g_return_if_fail (GST_IS_REGISTRY (registry)); g_return_if_fail (GST_IS_REGISTRY (registry));
g_return_if_fail (GST_IS_PLUGIN (plugin)); g_return_if_fail (GST_IS_PLUGIN (plugin));
name = gst_plugin_get_name (plugin);
/* Remove all features for this plugin */ /* Remove all features for this plugin */
f = registry->features; f = registry->features;
while (f != NULL) { while (f != NULL) {
GList *next = g_list_next (f); GList *next = g_list_next (f);
GstPluginFeature *feature = f->data; GstPluginFeature *feature = f->data;
if (G_UNLIKELY (feature && !strcmp (feature->plugin_name, name))) { if (G_UNLIKELY (feature && feature->plugin == plugin)) {
GST_DEBUG_OBJECT (registry, "removing feature %p (%s) for plugin %s", GST_DEBUG_OBJECT (registry, "removing feature %p (%s) for plugin %p (%s)",
feature, gst_plugin_feature_get_name (feature), name); feature, gst_plugin_feature_get_name (feature), plugin,
plugin->desc.name);
registry->features = g_list_delete_link (registry->features, f); registry->features = g_list_delete_link (registry->features, f);
g_hash_table_remove (registry->feature_hash, feature->name); g_hash_table_remove (registry->feature_hash, feature->name);