diff options
author | David Robillard <d@drobilla.net> | 2015-05-23 03:20:40 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2015-05-23 03:20:40 +0000 |
commit | dc5c579778d8b7b6f113c48d202f89c172abd591 (patch) | |
tree | 7a3a24f7acfab09c652ca466a46099766c8a02d3 /src/gui | |
parent | 63d4ffa098e016a9680b4b1b1f209ab3bb3dbd8c (diff) | |
download | ingen-dc5c579778d8b7b6f113c48d202f89c172abd591.tar.gz ingen-dc5c579778d8b7b6f113c48d202f89c172abd591.tar.bz2 ingen-dc5c579778d8b7b6f113c48d202f89c172abd591.zip |
Prevent concurrent Sord access.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5683 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/GraphCanvas.cpp | 4 | ||||
-rw-r--r-- | src/gui/ThreadedLoader.cpp | 25 | ||||
-rw-r--r-- | src/gui/ThreadedLoader.hpp | 5 |
3 files changed, 28 insertions, 6 deletions
diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp index ddbebfe7..0725aa67 100644 --- a/src/gui/GraphCanvas.cpp +++ b/src/gui/GraphCanvas.cpp @@ -598,6 +598,8 @@ serialise_arc(GanvEdge* arc, void* data) void GraphCanvas::copy_selection() { + std::lock_guard<std::mutex> lock(_app.world()->rdf_mutex()); + Serialiser serialiser(*_app.world()); serialiser.start_to_string(_graph->path(), _graph->base_uri()); @@ -614,6 +616,8 @@ GraphCanvas::paste() { typedef Node::Properties::const_iterator PropIter; + std::lock_guard<std::mutex> lock(_app.world()->rdf_mutex()); + const Glib::ustring str = Gtk::Clipboard::get()->wait_for_text(); SPtr<Parser> parser = _app.loader()->parser(); const URIs& uris = _app.uris(); diff --git a/src/gui/ThreadedLoader.cpp b/src/gui/ThreadedLoader.cpp index 8b7797cb..98314b66 100644 --- a/src/gui/ThreadedLoader.cpp +++ b/src/gui/ThreadedLoader.cpp @@ -77,8 +77,6 @@ ThreadedLoader::load_graph(bool merge, { _mutex.lock(); - Ingen::World* world = _app.world(); - Glib::ustring engine_base = ""; if (engine_parent) { if (merge) @@ -89,10 +87,7 @@ ThreadedLoader::load_graph(bool merge, _events.push_back( sigc::hide_return( - sigc::bind(sigc::mem_fun(world->parser().get(), - &Ingen::Parser::parse_file), - _app.world(), - _app.world()->interface().get(), + sigc::bind(sigc::mem_fun(this, &ThreadedLoader::load_graph_event), document_uri, engine_parent, engine_symbol, @@ -103,6 +98,22 @@ ThreadedLoader::load_graph(bool merge, } void +ThreadedLoader::load_graph_event(const Glib::ustring& document_uri, + optional<Raul::Path> engine_parent, + optional<Raul::Symbol> engine_symbol, + optional<Node::Properties> engine_data) +{ + std::lock_guard<std::mutex> lock(_app.world()->rdf_mutex()); + + _app.world()->parser()->parse_file(_app.world(), + _app.world()->interface().get(), + document_uri, + engine_parent, + engine_symbol, + engine_data); +} + +void ThreadedLoader::save_graph(SPtr<const Client::GraphModel> model, const string& filename) { @@ -122,6 +133,8 @@ ThreadedLoader::save_graph_event(SPtr<const Client::GraphModel> model, const string& filename) { if (_app.serialiser()) { + std::lock_guard<std::mutex> lock(_app.world()->rdf_mutex()); + if (filename.find(".ingen") != string::npos) { _app.serialiser()->write_bundle(model, filename); } else { diff --git a/src/gui/ThreadedLoader.hpp b/src/gui/ThreadedLoader.hpp index 87f1971b..7870761a 100644 --- a/src/gui/ThreadedLoader.hpp +++ b/src/gui/ThreadedLoader.hpp @@ -65,6 +65,11 @@ public: SPtr<Parser> parser(); private: + void load_graph_event(const Glib::ustring& document_uri, + boost::optional<Raul::Path> engine_parent, + boost::optional<Raul::Symbol> engine_symbol, + boost::optional<Node::Properties> engine_data); + void save_graph_event(SPtr<const Client::GraphModel> model, const std::string& filename); |