summaryrefslogtreecommitdiffstats
path: root/src/engine/events
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/events')
-rw-r--r--src/engine/events/ClearPatchEvent.cpp24
-rw-r--r--src/engine/events/ClearPatchEvent.hpp1
-rw-r--r--src/engine/events/DestroyEvent.cpp10
-rw-r--r--src/engine/events/DestroyEvent.hpp2
4 files changed, 27 insertions, 10 deletions
diff --git a/src/engine/events/ClearPatchEvent.cpp b/src/engine/events/ClearPatchEvent.cpp
index 7dfdbc3e..51e83154 100644
--- a/src/engine/events/ClearPatchEvent.cpp
+++ b/src/engine/events/ClearPatchEvent.cpp
@@ -36,7 +36,6 @@ namespace Ingen {
ClearPatchEvent::ClearPatchEvent(Engine& engine, SharedPtr<Responder> responder, FrameTime time, QueuedEventSource* source, const string& patch_path)
: QueuedEvent(engine, responder, time, true, source)
, _patch_path(patch_path)
- , _driver_port(NULL)
, _process(false)
, _ports_array(NULL)
, _compiled_patch(NULL)
@@ -88,12 +87,24 @@ ClearPatchEvent::execute(ProcessContext& context)
// Remove driver ports, if necessary
if (_patch->parent() == NULL) {
- for (EngineStore::Objects::iterator i = _removed_table->begin(); i != _removed_table->end(); ++i) {
+ for (EngineStore::Objects::iterator i = _removed_table->begin();
+ i != _removed_table->end(); ++i) {
SharedPtr<PortImpl> port = PtrCast<PortImpl>(i->second);
- if (port && port->type() == DataType::AUDIO)
- _driver_port = _engine.audio_driver()->remove_port(port->path());
- else if (port && port->type() == DataType::EVENT)
- _driver_port = _engine.midi_driver()->remove_port(port->path());
+ if (port && port->type() == DataType::AUDIO) {
+ List<DriverPort*>::Node* ln
+ = _engine.audio_driver()->remove_port(port->path());
+ assert(ln);
+ ln->elem()->unregister();
+ _engine.maid()->push(ln->elem());
+ _engine.maid()->push(ln);
+ } else if (port && port->type() == DataType::EVENT) {
+ List<DriverPort*>::Node* ln
+ = _engine.midi_driver()->remove_port(port->path());
+ assert(ln);
+ ln->elem()->unregister();
+ _engine.maid()->push(ln->elem());
+ _engine.maid()->push(ln);
+ }
}
}
}
@@ -105,7 +116,6 @@ ClearPatchEvent::post_process()
{
if (_patch != NULL) {
delete _ports_array;
- delete _driver_port;
// Restore patch's run state
if (_process)
diff --git a/src/engine/events/ClearPatchEvent.hpp b/src/engine/events/ClearPatchEvent.hpp
index 7fe76c65..ed91208f 100644
--- a/src/engine/events/ClearPatchEvent.hpp
+++ b/src/engine/events/ClearPatchEvent.hpp
@@ -50,7 +50,6 @@ public:
private:
const string _patch_path;
SharedPtr<PatchImpl> _patch;
- DriverPort* _driver_port;
bool _process;
Raul::Array<PortImpl*>* _ports_array; ///< New (external) ports for Patch
CompiledPatch* _compiled_patch; ///< Patch's new process order
diff --git a/src/engine/events/DestroyEvent.cpp b/src/engine/events/DestroyEvent.cpp
index c1ee15e7..52c19945 100644
--- a/src/engine/events/DestroyEvent.cpp
+++ b/src/engine/events/DestroyEvent.cpp
@@ -128,6 +128,7 @@ DestroyEvent::execute(ProcessContext& context)
if (_node->parent_patch()->compiled_patch())
_engine.maid()->push(_node->parent_patch()->compiled_patch());
+
_node->parent_patch()->compiled_patch(_compiled_patch);
} else if (_patch_port_listnode) {
@@ -151,6 +152,10 @@ DestroyEvent::execute(ProcessContext& context)
_driver_port = _engine.audio_driver()->remove_port(_port->path());
else if (_port->type() == DataType::EVENT)
_driver_port = _engine.midi_driver()->remove_port(_port->path());
+
+ // Apparently this needs to be called in post_process??
+ //if (_driver_port)
+ // _driver_port->elem()->unregister();
}
}
@@ -194,7 +199,10 @@ DestroyEvent::post_process()
_responder->respond_error("Unable to destroy object");
}
- delete _driver_port;
+ if (_driver_port) {
+ _driver_port->elem()->unregister();
+ _engine.maid()->push(_driver_port);
+ }
}
diff --git a/src/engine/events/DestroyEvent.hpp b/src/engine/events/DestroyEvent.hpp
index c260a480..59ff80ee 100644
--- a/src/engine/events/DestroyEvent.hpp
+++ b/src/engine/events/DestroyEvent.hpp
@@ -61,7 +61,7 @@ private:
EngineStore::iterator _store_iterator;
SharedPtr<NodeImpl> _node; ///< Non-NULL iff a node
SharedPtr<PortImpl> _port; ///< Non-NULL iff a port
- DriverPort* _driver_port;
+ Raul::List<DriverPort*>::Node* _driver_port;
PatchImpl::Nodes::Node* _patch_node_listnode;
Raul::List<PortImpl*>::Node* _patch_port_listnode;
Raul::Array<PortImpl*>* _ports_array; ///< New (external) ports for Patch