summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/GraphCanvas.cpp4
-rw-r--r--src/gui/ThreadedLoader.cpp25
-rw-r--r--src/gui/ThreadedLoader.hpp5
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);