summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2018-05-02 13:05:21 +0200
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>2020-07-06 14:31:48 +0000
commit3cfda6d6eb71dd420d05905d76e2aad52c07464b (patch)
tree85e6d62c3bcc1e085ec34ffc8f668ca514acd2e1
parentb1a171f912e64419f76ea5c4bff73691d6d84a89 (diff)
gstelementfactory: Fix missing features in case a feature moves to another filename
In case a plugin filename was renamed with the plugin being in the registry cache the features were not loaded after the rename: 1) Cache of old/gone filename was loaded, features added 2) New filename was loaded, features where not added because they were already found in the registry. 3) In the end stale cache entries for files which are no longer there are removed, including the wanted features. 4) The cache gets updated without the features. Fix this by also checking at (2) that the found feature is from the loaded plugin and not from some stale cache entry. This affected directsoundsink where libgstdirectsoundsink.dll was renamed to libgstdirectsound.dll, losing the directsoundsink element in the process. Fixes #290 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/102>
-rw-r--r--gst/gstelementfactory.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gst/gstelementfactory.c b/gst/gstelementfactory.c
index 49aaa97cf..d5619ac3d 100644
--- a/gst/gstelementfactory.c
+++ b/gst/gstelementfactory.c
@@ -219,7 +219,7 @@ gst_element_register (GstPlugin * plugin, const gchar * name, guint rank,
* features are removed and readded.
*/
existing_feature = gst_registry_lookup_feature (registry, name);
- if (existing_feature) {
+ if (existing_feature && existing_feature->plugin == plugin) {
GST_DEBUG_OBJECT (registry, "update existing feature %p (%s)",
existing_feature, name);
factory = GST_ELEMENT_FACTORY_CAST (existing_feature);
@@ -228,6 +228,8 @@ gst_element_register (GstPlugin * plugin, const gchar * name, guint rank,
g_type_set_qdata (type, __gst_elementclass_factory, factory);
gst_object_unref (existing_feature);
return TRUE;
+ } else if (existing_feature) {
+ gst_object_unref (existing_feature);
}
factory = g_object_new (GST_TYPE_ELEMENT_FACTORY, NULL);