diff options
-rw-r--r-- | src/server/events/Delete.cpp | 2 | ||||
-rw-r--r-- | src/server/events/DisconnectAll.cpp | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp index cd045820..7b284902 100644 --- a/src/server/events/Delete.cpp +++ b/src/server/events/Delete.cpp @@ -166,7 +166,7 @@ Delete::execute(RunContext& ctx) } GraphImpl* parent = _block ? _block->parent_graph() : nullptr; - if (_port) { + if (_ports_array && _port) { // Adjust port indices if necessary for (size_t i = 0; i < _ports_array->size(); ++i) { PortImpl* const port = _ports_array->at(i); diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp index 0442ddd9..35254ba0 100644 --- a/src/server/events/DisconnectAll.cpp +++ b/src/server/events/DisconnectAll.cpp @@ -122,6 +122,18 @@ DisconnectAll::pre_process(PreProcessContext& ctx) dynamic_cast<InputPort*>(a->head()))); } + // Create disconnect events to erase adjacent arcs in parent's parent + if (_port && _parent->parent()) { + GraphImpl* parent_parent = dynamic_cast<GraphImpl*>(_parent->parent()); + for (const auto& a : adjacent_arcs(parent_parent)) { + _impls.push_back( + new Disconnect::Impl(_engine, + parent_parent, + dynamic_cast<PortImpl*>(a->tail()), + dynamic_cast<InputPort*>(a->head()))); + } + } + if (!_deleting && ctx.must_compile(*_parent)) { if (!(_compiled_graph = compile(*_engine.maid(), *_parent))) { return Event::pre_process_done(Status::COMPILATION_FAILED); |