diff options
author | David Robillard <d@drobilla.net> | 2007-09-20 16:23:03 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-09-20 16:23:03 +0000 |
commit | a4625db3f26716fb7a34614c76582ab92b5212e8 (patch) | |
tree | 645f6b35f06a8a7d6cad4a8d59fad9f61346d196 | |
parent | c4a88de11f5a4c08418523a1f0fd0634b2f56857 (diff) | |
download | ingen-a4625db3f26716fb7a34614c76582ab92b5212e8.tar.gz ingen-a4625db3f26716fb7a34614c76582ab92b5212e8.tar.bz2 ingen-a4625db3f26716fb7a34614c76582ab92b5212e8.zip |
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
-rw-r--r-- | src/libs/client/NodeModel.cpp | 2 | ||||
-rw-r--r-- | src/libs/client/PluginModel.cpp | 4 | ||||
-rw-r--r-- | src/libs/client/PluginModel.hpp | 9 | ||||
-rw-r--r-- | src/libs/gui/App.cpp | 2 | ||||
-rw-r--r-- | src/libs/gui/PatchCanvas.cpp | 2 |
5 files changed, 19 insertions, 0 deletions
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<PortModel> 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 <iostream> #include <raul/Path.hpp> #include <raul/SharedPtr.hpp> +#include <raul/RDFWorld.hpp> #ifdef HAVE_SLV2 #include <slv2/slv2.h> #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; }; diff --git a/src/libs/gui/App.cpp b/src/libs/gui/App.cpp index b36c5c07..b07352d7 100644 --- a/src/libs/gui/App.cpp +++ b/src/libs/gui/App.cpp @@ -85,6 +85,8 @@ App::App(Ingen::Shared::World* world) rdf_world.add_prefix("rdfs", "http://www.w3.org/2000/01/rdf-schema#"); rdf_world.add_prefix("doap", "http://usefulinc.com/ns/doap#"); + PluginModel::set_rdf_world(rdf_world); + #ifdef HAVE_SLV2 PluginModel::set_slv2_world(world->slv2_world); #endif diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp index dc1504ef..ee3c326e 100644 --- a/src/libs/gui/PatchCanvas.cpp +++ b/src/libs/gui/PatchCanvas.cpp @@ -171,6 +171,8 @@ PatchCanvas::build_plugin_class_menu(Gtk::Menu* menu, void PatchCanvas::build_plugin_menu() { + Glib::Mutex::Lock(PluginModel::rdf_world()->mutex()); + _menu->items().push_back(Gtk::Menu_Helpers::ImageMenuElem("Plugin", *(manage(new Gtk::Image(Gtk::Stock::EXECUTE, Gtk::ICON_SIZE_MENU))))); Gtk::MenuItem* plugin_menu_item = &(_menu->items().back()); |