summaryrefslogtreecommitdiffstats
path: root/src/libs/client
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-08-14 04:03:14 +0000
committerDavid Robillard <d@drobilla.net>2008-08-14 04:03:14 +0000
commit58e8d1cddd520ae0ddf39f16210f1500868a2b2e (patch)
tree3da3105ec9c526f36352295b6d75c390e05c26b5 /src/libs/client
parent2ad7b1dab1cbbc9a35fe84ce784179d78fba3a29 (diff)
downloadingen-58e8d1cddd520ae0ddf39f16210f1500868a2b2e.tar.gz
ingen-58e8d1cddd520ae0ddf39f16210f1500868a2b2e.tar.bz2
ingen-58e8d1cddd520ae0ddf39f16210f1500868a2b2e.zip
Lock RDF world mutex in all places slv2 or redland is accessed (fix random segfaults usually on patch loading).
git-svn-id: http://svn.drobilla.net/lad/ingen@1367 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/client')
-rw-r--r--src/libs/client/NodeModel.cpp2
-rw-r--r--src/libs/client/PluginModel.cpp8
-rw-r--r--src/libs/client/PluginModel.hpp3
-rw-r--r--src/libs/client/PluginUI.cpp2
4 files changed, 11 insertions, 4 deletions
diff --git a/src/libs/client/NodeModel.cpp b/src/libs/client/NodeModel.cpp
index d1c6c271..7cee66f9 100644
--- a/src/libs/client/NodeModel.cpp
+++ b/src/libs/client/NodeModel.cpp
@@ -167,7 +167,7 @@ NodeModel::port_value_range(SharedPtr<PortModel> port, float& min, float& max)
if (!_min_values) {
- Glib::Mutex::Lock(PluginModel::rdf_world()->mutex());
+ Glib::Mutex::Lock lock(PluginModel::rdf_world()->mutex());
uint32_t num_lv2_ports = slv2_plugin_get_num_ports(_plugin->slv2_plugin());
_min_values = new float[num_lv2_ports];
diff --git a/src/libs/client/PluginModel.cpp b/src/libs/client/PluginModel.cpp
index 8c2705da..db62b3bf 100644
--- a/src/libs/client/PluginModel.cpp
+++ b/src/libs/client/PluginModel.cpp
@@ -50,9 +50,9 @@ PluginModel::ui(Ingen::Shared::World* world, SharedPtr<NodeModel> node) const
if (_type != LV2)
return SharedPtr<PluginUI>();
- Glib::Mutex::Lock(_rdf_world->mutex());
-
- return PluginUI::create(world, node, _slv2_plugin);
+ Glib::Mutex::Lock lock(_rdf_world->mutex());
+ SharedPtr<PluginUI> ret = PluginUI::create(world, node, _slv2_plugin);
+ return ret;
}
@@ -69,6 +69,8 @@ PluginModel::icon_path() const
string
PluginModel::get_lv2_icon_path(SLV2Plugin plugin)
{
+ Glib::Mutex::Lock lock(_rdf_world->mutex());
+
string result;
SLV2Value svg_icon_pred = slv2_value_new_uri(_slv2_world,
"http://ll-plugins.nongnu.org/lv2/namespace#svgIcon");
diff --git a/src/libs/client/PluginModel.hpp b/src/libs/client/PluginModel.hpp
index 4e2bfab1..a7adc735 100644
--- a/src/libs/client/PluginModel.hpp
+++ b/src/libs/client/PluginModel.hpp
@@ -55,6 +55,7 @@ public:
, _name(name)
{
#ifdef HAVE_SLV2
+ Glib::Mutex::Lock lock(_rdf_world->mutex());
SLV2Value plugin_uri = slv2_value_new_uri(_slv2_world, uri.c_str());
_slv2_plugin = slv2_plugins_get_by_uri(_slv2_plugins, plugin_uri);
slv2_value_free(plugin_uri);
@@ -89,10 +90,12 @@ public:
SLV2Plugin slv2_plugin() { return _slv2_plugin; }
SLV2Port slv2_port(uint32_t index) {
+ Glib::Mutex::Lock lock(_rdf_world->mutex());
return slv2_plugin_get_port_by_index(_slv2_plugin, index);
}
static void set_slv2_world(SLV2World world) {
+ Glib::Mutex::Lock lock(_rdf_world->mutex());
_slv2_world = world;
_slv2_plugins = slv2_world_get_all_plugins(_slv2_world);
}
diff --git a/src/libs/client/PluginUI.cpp b/src/libs/client/PluginUI.cpp
index b341bb0f..f2f591bd 100644
--- a/src/libs/client/PluginUI.cpp
+++ b/src/libs/client/PluginUI.cpp
@@ -107,6 +107,7 @@ PluginUI::PluginUI(Ingen::Shared::World* world,
PluginUI::~PluginUI()
{
+ Glib::Mutex::Lock lock(PluginModel::rdf_world()->mutex());
slv2_ui_instance_free(_instance);
}
@@ -116,6 +117,7 @@ PluginUI::create(Ingen::Shared::World* world,
SharedPtr<NodeModel> node,
SLV2Plugin plugin)
{
+ Glib::Mutex::Lock lock(PluginModel::rdf_world()->mutex());
SharedPtr<PluginUI> ret;
SLV2Value gtk_gui_uri = slv2_value_new_uri(world->slv2_world,