summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-03-14 19:03:33 -0400
committerDavid Robillard <d@drobilla.net>2016-03-14 19:03:33 -0400
commit4ee3f2666d79256a69ed66d511cbe64b83e4de5f (patch)
tree4a8b93138eb22c0b70c13de7204c998bc80898e9 /src
parent4ffc37f349871bc54373846ed9fc759f06c20294 (diff)
downloadingen-4ee3f2666d79256a69ed66d511cbe64b83e4de5f.tar.gz
ingen-4ee3f2666d79256a69ed66d511cbe64b83e4de5f.tar.bz2
ingen-4ee3f2666d79256a69ed66d511cbe64b83e4de5f.zip
Remove arcs in client store on object deletion
Fix #1120.
Diffstat (limited to 'src')
-rw-r--r--src/client/ClientStore.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp
index 12674981..7afa4aee 100644
--- a/src/client/ClientStore.cpp
+++ b/src/client/ClientStore.cpp
@@ -106,28 +106,30 @@ ClientStore::remove_object(const Raul::Path& path)
SPtr<ObjectModel> object = dynamic_ptr_cast<ObjectModel>(top->second);
+ // Remove object and any adjacent arcs from parent if applicable
+ if (object && object->parent()) {
+ SPtr<PortModel> port = dynamic_ptr_cast<PortModel>(object);
+ if (port && dynamic_ptr_cast<GraphModel>(port->parent())) {
+ disconnect_all(port->parent()->path(), path);
+ if (port->parent()->parent()) {
+ disconnect_all(port->parent()->parent()->path(), path);
+ }
+ } else if (port && port->parent()->parent()) {
+ disconnect_all(port->parent()->parent()->path(), path);
+ } else {
+ disconnect_all(object->parent()->path(), path);
+ }
+
+ object->parent()->remove_child(object);
+ }
+
// Remove the object and all its descendants
Objects removed;
remove(top, removed);
- // Notify everything that needs to know this object is going away
+ // Notify everything that needs to know this object has been removed
if (object) {
- // Notify the program this object is going away
object->signal_destroyed().emit();
-
- // Remove object from parent model if applicable
- if (object->parent()) {
- SPtr<PortModel> port = dynamic_ptr_cast<PortModel>(object);
- SPtr<GraphModel> gpparent = dynamic_ptr_cast<GraphModel>(
- object->parent()->parent());
- if (port && gpparent) {
- /* Port on a block in a graph (probably on a subgraph),
- remove any connections in the parent's parent graph. */
- gpparent->remove_arcs_on(port);
- }
-
- object->parent()->remove_child(object);
- }
}
return object;