From a4625db3f26716fb7a34614c76582ab92b5212e8 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 20 Sep 2007 16:23:03 +0000 Subject: Fix RDF threading problems (random messy crashes on patch loading). git-svn-id: http://svn.drobilla.net/lad/ingen@740 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/client/NodeModel.cpp | 2 ++ src/libs/client/PluginModel.cpp | 4 ++++ src/libs/client/PluginModel.hpp | 9 +++++++++ 3 files changed, 15 insertions(+) (limited to 'src/libs/client') diff --git a/src/libs/client/NodeModel.cpp b/src/libs/client/NodeModel.cpp index c7b38ceb..8c5892e7 100644 --- a/src/libs/client/NodeModel.cpp +++ b/src/libs/client/NodeModel.cpp @@ -151,6 +151,8 @@ NodeModel::port_value_range(SharedPtr port, float& min, float& max) { assert(port->parent().get() == this); + Glib::Mutex::Lock(PluginModel::rdf_world()->mutex()); + // FIXME: cache these values // Plugin value first diff --git a/src/libs/client/PluginModel.cpp b/src/libs/client/PluginModel.cpp index 1e6729d6..10c767ff 100644 --- a/src/libs/client/PluginModel.cpp +++ b/src/libs/client/PluginModel.cpp @@ -28,6 +28,8 @@ namespace Client { SLV2World PluginModel::_slv2_world = NULL; SLV2Plugins PluginModel::_slv2_plugins = NULL; #endif + +Raul::RDF::World* PluginModel::_rdf_world = NULL; string @@ -56,6 +58,8 @@ PluginModel::gui() { assert(_type == LV2); + Glib::Mutex::Lock(_rdf_world->mutex()); + SLV2Values gui = slv2_plugin_get_guis(_slv2_plugin); if (slv2_values_size(gui) > 0) { printf("\tGUI:\n"); diff --git a/src/libs/client/PluginModel.hpp b/src/libs/client/PluginModel.hpp index a8d420b8..ba5598c0 100644 --- a/src/libs/client/PluginModel.hpp +++ b/src/libs/client/PluginModel.hpp @@ -23,6 +23,7 @@ #include #include #include +#include #ifdef HAVE_SLV2 #include #endif @@ -109,6 +110,12 @@ public: void* gui(); #endif + static void set_rdf_world(Raul::RDF::World& world) { + _rdf_world = &world; + } + + static Raul::RDF::World* rdf_world() { return _rdf_world; } + private: Type _type; string _uri; @@ -120,6 +127,8 @@ private: SLV2Plugin _slv2_plugin; #endif + + static Raul::RDF::World* _rdf_world; }; -- cgit v1.2.1