From 58e8d1cddd520ae0ddf39f16210f1500868a2b2e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 14 Aug 2008 04:03:14 +0000 Subject: 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 --- src/libs/client/NodeModel.cpp | 2 +- src/libs/client/PluginModel.cpp | 8 +++++--- src/libs/client/PluginModel.hpp | 3 +++ src/libs/client/PluginUI.cpp | 2 ++ 4 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src/libs/client') 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 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 node) const if (_type != LV2) return SharedPtr(); - Glib::Mutex::Lock(_rdf_world->mutex()); - - return PluginUI::create(world, node, _slv2_plugin); + Glib::Mutex::Lock lock(_rdf_world->mutex()); + SharedPtr 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 node, SLV2Plugin plugin) { + Glib::Mutex::Lock lock(PluginModel::rdf_world()->mutex()); SharedPtr ret; SLV2Value gtk_gui_uri = slv2_value_new_uri(world->slv2_world, -- cgit v1.2.1