From 69c5e7fe16b7d9d08db81a6d5e2762f0be3b081f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 6 Jan 2007 19:39:56 +0000 Subject: Added ability to get Raul Thread for current calling context. Strong threading assertions. Flowcanvas port removal fixes. Patch port destruction. Code cleanups, bug fixes. git-svn-id: http://svn.drobilla.net/lad/ingen@234 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/events/AddPortEvent.cpp | 9 +++++---- src/libs/engine/events/CreatePatchEvent.cpp | 14 ++++++-------- src/libs/engine/events/DestroyEvent.cpp | 15 ++++++++++----- src/libs/engine/events/DestroyEvent.h | 1 + 4 files changed, 22 insertions(+), 17 deletions(-) (limited to 'src/libs/engine/events') diff --git a/src/libs/engine/events/AddPortEvent.cpp b/src/libs/engine/events/AddPortEvent.cpp index aa7c3ca5..bdce9267 100644 --- a/src/libs/engine/events/AddPortEvent.cpp +++ b/src/libs/engine/events/AddPortEvent.cpp @@ -106,8 +106,8 @@ AddPortEvent::pre_process() _ports_array = new Array(old_num_ports + 1, NULL); - _ports_array->at(_patch->num_ports()) = _patch_port; - _engine.object_store()->add(_patch_port); + _ports_array->at(_patch->num_ports()-1) = _patch_port; + _patch_port->add_to_store(_engine.object_store()); if (!_patch->parent()) { if (_type == "ingen:audio") @@ -118,8 +118,9 @@ AddPortEvent::pre_process() dynamic_cast*>(_patch_port)); } - assert(_patch->num_ports() == old_num_ports); - assert(_ports_array->size() == _patch->num_ports() + 1); + assert(_ports_array->size() == _patch->num_ports()); + + } } QueuedEvent::pre_process(); diff --git a/src/libs/engine/events/CreatePatchEvent.cpp b/src/libs/engine/events/CreatePatchEvent.cpp index 9124f280..73813dbb 100644 --- a/src/libs/engine/events/CreatePatchEvent.cpp +++ b/src/libs/engine/events/CreatePatchEvent.cpp @@ -45,7 +45,7 @@ CreatePatchEvent::CreatePatchEvent(Engine& engine, SharedPtr responde void CreatePatchEvent::pre_process() { - if (_engine.object_store()->find(m_path) != NULL) { + if (m_path == "/" || _engine.object_store()->find(m_path) != NULL) { m_error = OBJECT_EXISTS; QueuedEvent::pre_process(); return; @@ -57,13 +57,11 @@ CreatePatchEvent::pre_process() return; } - if (m_path != "/") { - m_parent = _engine.object_store()->find_patch(m_path.parent()); - if (m_parent == NULL) { - m_error = PARENT_NOT_FOUND; - QueuedEvent::pre_process(); - return; - } + m_parent = _engine.object_store()->find_patch(m_path.parent()); + if (m_parent == NULL) { + m_error = PARENT_NOT_FOUND; + QueuedEvent::pre_process(); + return; } size_t poly = 1; diff --git a/src/libs/engine/events/DestroyEvent.cpp b/src/libs/engine/events/DestroyEvent.cpp index 9801f0fe..26902697 100644 --- a/src/libs/engine/events/DestroyEvent.cpp +++ b/src/libs/engine/events/DestroyEvent.cpp @@ -43,6 +43,7 @@ DestroyEvent::DestroyEvent(Engine& engine, SharedPtr responder, Frame _patch_node_listnode(NULL), _patch_port_listnode(NULL), _store_treenode(NULL), + _ports_array(NULL), _process_order(NULL), _disconnect_node_event(NULL), _disconnect_port_event(NULL) @@ -60,6 +61,7 @@ DestroyEvent::DestroyEvent(Engine& engine, SharedPtr responder, Frame _patch_node_listnode(NULL), _patch_port_listnode(NULL), _store_treenode(NULL), + _ports_array(NULL), _process_order(NULL), _disconnect_node_event(NULL), _disconnect_port_event(NULL) @@ -131,11 +133,8 @@ DestroyEvent::pre_process() if (_port->parent_patch()->enabled()) { // FIXME: is this called multiple times? _process_order = _port->parent_patch()->build_process_order(); - // Remove port to be removed from the process order so it isn't executed by - // Patch::run and can safely be destroyed - //for (size_t i=0; i < _process_order->size(); ++i) - // if (_process_order->at(i) == _port) - // _process_order->at(i) = NULL; // ew, gap + _ports_array = _port->parent_patch()->build_ports_array(); + assert(_ports_array->size() == _port->parent_patch()->num_ports()); } } @@ -168,7 +167,13 @@ DestroyEvent::execute(SampleCount nframes, FrameTime start, FrameTime end) if (_port->parent_patch()->process_order() != NULL) _engine.maid()->push(_port->parent_patch()->process_order()); + _port->parent_patch()->process_order(_process_order); + + if (_port->parent_patch()->external_ports() != NULL) + _engine.maid()->push(_port->parent_patch()->external_ports()); + + _port->parent_patch()->external_ports(_ports_array); } } diff --git a/src/libs/engine/events/DestroyEvent.h b/src/libs/engine/events/DestroyEvent.h index ad67bbca..6dfebbf7 100644 --- a/src/libs/engine/events/DestroyEvent.h +++ b/src/libs/engine/events/DestroyEvent.h @@ -61,6 +61,7 @@ private: ListNode* _patch_node_listnode; ListNode* _patch_port_listnode; TreeNode* _store_treenode; + Array* _ports_array; ///< New (external) ports array for Patch Array* _process_order; ///< Patch's new process order DisconnectNodeEvent* _disconnect_node_event; DisconnectPortEvent* _disconnect_port_event; -- cgit v1.2.1