summaryrefslogtreecommitdiffstats
path: root/src/client/GraphModel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/GraphModel.cpp')
-rw-r--r--src/client/GraphModel.cpp38
1 files changed, 22 insertions, 16 deletions
diff --git a/src/client/GraphModel.cpp b/src/client/GraphModel.cpp
index 764c3b75..cebaa759 100644
--- a/src/client/GraphModel.cpp
+++ b/src/client/GraphModel.cpp
@@ -50,6 +50,23 @@ GraphModel::remove_child(SPtr<ObjectModel> o)
assert(o->path().is_child_of(path()));
assert(o->parent().get() == this);
+ SPtr<PortModel> pm = dynamic_ptr_cast<PortModel>(o);
+ if (pm) {
+ remove_arcs_on(pm);
+ remove_port(pm);
+ }
+
+ SPtr<BlockModel> bm = dynamic_ptr_cast<BlockModel>(o);
+ if (bm) {
+ _signal_removed_block.emit(bm);
+ }
+
+ return true;
+}
+
+void
+GraphModel::remove_arcs_on(SPtr<PortModel> p)
+{
// Remove any connections which referred to this object,
// since they can't possibly exist anymore
for (Arcs::iterator j = _arcs.begin(); j != _arcs.end();) {
@@ -57,26 +74,15 @@ GraphModel::remove_child(SPtr<ObjectModel> o)
++next;
SPtr<ArcModel> arc = dynamic_ptr_cast<ArcModel>(j->second);
- if (arc->tail_path().parent() == o->path()
- || arc->tail_path() == o->path()
- || arc->head_path().parent() == o->path()
- || arc->head_path() == o->path()) {
+ if (arc->tail_path().parent() == p->path()
+ || arc->tail_path() == p->path()
+ || arc->head_path().parent() == p->path()
+ || arc->head_path() == p->path()) {
_signal_removed_arc.emit(arc);
- _arcs.erase(j); // cuts our reference
+ _arcs.erase(j); // Cuts our reference
}
j = next;
}
-
- SPtr<PortModel> pm = dynamic_ptr_cast<PortModel>(o);
- if (pm)
- remove_port(pm);
-
- SPtr<BlockModel> bm = dynamic_ptr_cast<BlockModel>(o);
- if (bm) {
- _signal_removed_block.emit(bm);
- }
-
- return true;
}
void