diff options
author | David Robillard <d@drobilla.net> | 2015-11-14 19:24:23 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2016-09-11 14:41:21 +0200 |
commit | fb2744d4265d26fb98b19689b50d127f32c66eab (patch) | |
tree | 3e4b9a56c85e9903cfe8be5dd634695298f4c9fd | |
parent | d1e58b25654ab25607329afacc9a23d829267637 (diff) | |
download | ingen-fb2744d4265d26fb98b19689b50d127f32c66eab.tar.gz ingen-fb2744d4265d26fb98b19689b50d127f32c66eab.tar.bz2 ingen-fb2744d4265d26fb98b19689b50d127f32c66eab.zip |
Clarify connect and disconnect logic
-rw-r--r-- | src/server/events/Connect.cpp | 1 | ||||
-rw-r--r-- | src/server/events/Disconnect.cpp | 7 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp index f0ba39bb..09838978 100644 --- a/src/server/events/Connect.cpp +++ b/src/server/events/Connect.cpp @@ -111,6 +111,7 @@ Connect::pre_process() provider... */ if (tail_block != head_block && tail_block->parent() == head_block->parent()) { + // The tail block is now a dependency (provider) of the head block head_block->providers().insert(tail_block); tail_block->dependants().insert(head_block); } diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp index 13f419ce..43febed5 100644 --- a/src/server/events/Disconnect.cpp +++ b/src/server/events/Disconnect.cpp @@ -14,7 +14,7 @@ along with Ingen. If not, see <http://www.gnu.org/licenses/>. */ -#include <list> +#include <set> #include "ingen/Store.hpp" #include "raul/Maid.hpp" @@ -72,11 +72,13 @@ Disconnect::Impl::Impl(Engine& e, BlockImpl* const tail_block = _tail->parent_block(); BlockImpl* const head_block = _head->parent_block(); + // Remove tail from head's providers std::set<BlockImpl*>::iterator hp = head_block->providers().find(tail_block); if (hp != head_block->providers().end()) { head_block->providers().erase(hp); } + // Remove head from tail's providers std::set<BlockImpl*>::iterator td = tail_block->dependants().find(head_block); if (td != tail_block->dependants().end()) { tail_block->dependants().erase(td); @@ -173,8 +175,7 @@ Disconnect::pre_process() bool Disconnect::Impl::execute(ProcessContext& context, bool set_head_buffers) { - ArcImpl* const port_arc = - _head->remove_arc(context, _tail); + ArcImpl* const port_arc = _head->remove_arc(context, _tail); if (!port_arc) { return false; |