summaryrefslogtreecommitdiffstats
path: root/src/server/NodeImpl.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-08-15 05:24:41 +0000
committerDavid Robillard <d@drobilla.net>2012-08-15 05:24:41 +0000
commit5dd1d9b720993fc7813fe12fca0844f95033ff1b (patch)
tree344151dd656894340d217a8fe33f8dba53fe160f /src/server/NodeImpl.cpp
parent0a9297ed2a1622d252a389d8babc0656fedbe7fd (diff)
downloadingen-5dd1d9b720993fc7813fe12fca0844f95033ff1b.tar.gz
ingen-5dd1d9b720993fc7813fe12fca0844f95033ff1b.tar.bz2
ingen-5dd1d9b720993fc7813fe12fca0844f95033ff1b.zip
Use intrusive lists to store nodes and ports in their parent patch to avoid tedious allocated list node juggling.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4700 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/NodeImpl.cpp')
-rw-r--r--src/server/NodeImpl.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/server/NodeImpl.cpp b/src/server/NodeImpl.cpp
index f3277a2d..f1f6c362 100644
--- a/src/server/NodeImpl.cpp
+++ b/src/server/NodeImpl.cpp
@@ -53,8 +53,13 @@ NodeImpl::NodeImpl(PluginImpl* plugin,
NodeImpl::~NodeImpl()
{
- if (_activated)
+ if (_activated) {
deactivate();
+ }
+
+ if (is_linked()) {
+ parent_patch()->remove_node(*this);
+ }
delete _ports;
}
@@ -75,9 +80,8 @@ void
NodeImpl::activate(BufferFactory& bufs)
{
ThreadManager::assert_thread(THREAD_PRE_PROCESS);
- assert(!_activated);
- _activated = true;
+ _activated = true;
for (uint32_t p = 0; p < num_ports(); ++p) {
PortImpl* const port = _ports->at(p);
port->setup_buffers(bufs, port->poly(), false);
@@ -89,7 +93,6 @@ NodeImpl::activate(BufferFactory& bufs)
void
NodeImpl::deactivate()
{
- assert(_activated);
_activated = false;
for (uint32_t i = 0; i < _polyphony; ++i) {
for (uint32_t j = 0; j < num_ports(); ++j) {