mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-02 21:48:55 +00:00
gst/gstpluginfeature.c: Protect plugin loading by a mutex so it's threadsafe. Fixes #163234.
Original commit message from CVS: Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net> * gst/gstpluginfeature.c: (gst_plugin_feature_ensure_loaded): Protect plugin loading by a mutex so it's threadsafe. Fixes #163234.
This commit is contained in:
parent
58efb5a941
commit
1ffedb43a3
2 changed files with 22 additions and 3 deletions
|
@ -1,3 +1,11 @@
|
|||
2005-01-09 Sebastien Cote <sc5@hermes.usherb.ca>
|
||||
|
||||
Reviewed by: Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
||||
|
||||
* gst/gstpluginfeature.c: (gst_plugin_feature_ensure_loaded):
|
||||
Protect plugin loading by a mutex so it's threadsafe. Fixes
|
||||
#163234.
|
||||
|
||||
2005-01-08 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
||||
|
||||
* gst/gstevent.c: (_gst_event_copy):
|
||||
|
|
|
@ -91,11 +91,13 @@ gboolean
|
|||
gst_plugin_feature_ensure_loaded (GstPluginFeature * feature)
|
||||
{
|
||||
GstPlugin *plugin;
|
||||
static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
|
||||
|
||||
g_return_val_if_fail (feature != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_IS_PLUGIN_FEATURE (feature), FALSE);
|
||||
|
||||
plugin = (GstPlugin *) (feature->manager);
|
||||
g_static_mutex_lock (&mutex);
|
||||
|
||||
if (plugin && !gst_plugin_is_loaded (plugin)) {
|
||||
#ifndef GST_DISABLE_REGISTRY
|
||||
|
@ -104,12 +106,21 @@ gst_plugin_feature_ensure_loaded (GstPluginFeature * feature)
|
|||
"loading plugin %s for feature", plugin->desc.name);
|
||||
|
||||
if (gst_registry_load_plugin (GST_REGISTRY (plugin->manager),
|
||||
plugin) != GST_REGISTRY_OK)
|
||||
plugin) != GST_REGISTRY_OK) {
|
||||
g_static_mutex_unlock (&mutex);
|
||||
return FALSE;
|
||||
} else
|
||||
#endif /* GST_DISABLE_REGISTRY */
|
||||
}
|
||||
} else {
|
||||
g_static_mutex_unlock (&mutex);
|
||||
return FALSE;
|
||||
}
|
||||
#else /* GST_DISABLE_REGISTRY */
|
||||
g_static_mutex_unlock (&mutex);
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
g_static_mutex_unlock (&mutex);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue