summaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/client/PatchModel.cpp8
-rw-r--r--src/libs/client/PatchModel.h27
-rw-r--r--src/libs/client/Store.cpp13
-rw-r--r--src/libs/engine/ObjectSender.cpp6
-rw-r--r--src/libs/engine/events/DisconnectNodeEvent.cpp6
5 files changed, 38 insertions, 22 deletions
diff --git a/src/libs/client/PatchModel.cpp b/src/libs/client/PatchModel.cpp
index 551b3d4c..7d786301 100644
--- a/src/libs/client/PatchModel.cpp
+++ b/src/libs/client/PatchModel.cpp
@@ -49,12 +49,12 @@ PatchModel::set_path(const Path& new_path)
}
-NodeModel*
+CountedPtr<NodeModel>
PatchModel::get_node(const string& name)
{
assert(name.find("/") == string::npos);
NodeModelMap::iterator i = m_nodes.find(name);
- return ((i != m_nodes.end()) ? (*i).second.get() : NULL);
+ return ((i != m_nodes.end()) ? (*i).second : CountedPtr<NodeModel>(NULL));
}
@@ -173,9 +173,9 @@ PatchModel::add_connection(CountedPtr<ConnectionModel> cm)
return;
}
- NodeModel* src_node = get_node(cm->src_port_path().parent().name());
+ NodeModel* src_node = get_node(cm->src_port_path().parent().name()).get();
PortModel* src_port = (src_node == NULL) ? NULL : src_node->get_port(cm->src_port_path().name()).get();
- NodeModel* dst_node = get_node(cm->dst_port_path().parent().name());
+ NodeModel* dst_node = get_node(cm->dst_port_path().parent().name()).get();
PortModel* dst_port = (dst_node == NULL) ? NULL : dst_node->get_port(cm->dst_port_path().name()).get();
assert(src_port != NULL);
diff --git a/src/libs/client/PatchModel.h b/src/libs/client/PatchModel.h
index 6b3b212f..c099d768 100644
--- a/src/libs/client/PatchModel.h
+++ b/src/libs/client/PatchModel.h
@@ -44,20 +44,21 @@ public:
m_poly(poly)
{}
- const NodeModelMap& nodes() const { return m_nodes; }
+ const NodeModelMap& nodes() const { return m_nodes; }
const list<CountedPtr<ConnectionModel> >& connections() const { return m_connections; }
virtual void set_path(const Path& path);
- NodeModel* get_node(const string& node_name);
- void add_node(CountedPtr<NodeModel> nm);
- void remove_node(const string& name);
+ CountedPtr<NodeModel> get_node(const string& node_name);
+ void add_node(CountedPtr<NodeModel> nm);
+ void remove_node(const string& name);
- void rename_node(const Path& old_path, const Path& new_path);
- void rename_node_port(const Path& old_path, const Path& new_path);
+ void rename_node(const Path& old_path, const Path& new_path);
+ void rename_node_port(const Path& old_path, const Path& new_path);
+
CountedPtr<ConnectionModel> get_connection(const string& src_port_path, const string& dst_port_path);
- void add_connection(CountedPtr<ConnectionModel> cm);
- void remove_connection(const string& src_port_path, const string& dst_port_path);
+ void add_connection(CountedPtr<ConnectionModel> cm);
+ void remove_connection(const string& src_port_path, const string& dst_port_path);
virtual void clear();
@@ -80,11 +81,11 @@ private:
PatchModel(const PatchModel& copy);
PatchModel& operator=(const PatchModel& copy);
- NodeModelMap m_nodes;
- list<CountedPtr<ConnectionModel> > m_connections;
- string m_filename;
- bool m_enabled;
- size_t m_poly;
+ NodeModelMap m_nodes;
+ list<CountedPtr<ConnectionModel> > m_connections;
+ string m_filename;
+ bool m_enabled;
+ size_t m_poly;
};
typedef map<string, PatchModel*> PatchModelMap;
diff --git a/src/libs/client/Store.cpp b/src/libs/client/Store.cpp
index d1555f4d..ef70dc28 100644
--- a/src/libs/client/Store.cpp
+++ b/src/libs/client/Store.cpp
@@ -209,6 +209,17 @@ Store::new_patch_event(const string& path, uint32_t poly)
if (m_objects.find(path) == m_objects.end()) {
PatchModel* const p = new PatchModel(path, poly);
add_object(p);
+
+ std::map<string, CountedPtr<ObjectModel> >::iterator pi = m_objects.find(p->path().parent());
+ if (pi != m_objects.end()) {
+ CountedPtr<PatchModel> parent = (*pi).second;
+ if (parent) {
+ p->set_parent(parent);
+ parent->add_node(p);
+ } else {
+ cerr << "ERROR: new patch with no parent" << endl;
+ }
+ }
}
}
@@ -217,8 +228,6 @@ void
Store::new_node_event(const string& plugin_type, const string& plugin_uri, const string& node_path, bool is_polyphonic, uint32_t num_ports)
{
// FIXME: What to do with a conflict?
- // FIXME: resolve plugin here
-
if (m_objects.find(node_path) == m_objects.end()) {
diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp
index 9d3e535d..441cb2d9 100644
--- a/src/libs/engine/ObjectSender.cpp
+++ b/src/libs/engine/ObjectSender.cpp
@@ -90,8 +90,12 @@ ObjectSender::send_node(ClientInterface* client, const Node* node)
&& node->poly() == node->parent_patch()->internal_poly()
? 1 : 0);
- assert(node->plugin()->uri().length() > 0);
assert(node->path().length() > 0);
+ if (node->plugin()->uri().length() == 0) {
+ cerr << "Node " << node->path() << " plugin has no URI! Not sending." << endl;
+ return;
+ }
+
client->bundle_begin();
diff --git a/src/libs/engine/events/DisconnectNodeEvent.cpp b/src/libs/engine/events/DisconnectNodeEvent.cpp
index 17367dd4..4c4e19a7 100644
--- a/src/libs/engine/events/DisconnectNodeEvent.cpp
+++ b/src/libs/engine/events/DisconnectNodeEvent.cpp
@@ -127,11 +127,13 @@ void
DisconnectNodeEvent::post_process()
{
if (m_succeeded) {
- m_responder->respond_ok();
+ if (m_responder)
+ m_responder->respond_ok();
for (List<DisconnectionEvent*>::iterator i = m_disconnection_events.begin(); i != m_disconnection_events.end(); ++i)
(*i)->post_process();
} else {
- m_responder->respond_error("Unable to disconnect all ports.");
+ if (m_responder)
+ m_responder->respond_error("Unable to disconnect all ports.");
}
}