Fixed engine-side node destruction bug

git-svn-id: http://svn.drobilla.net/lad@34 a436a847-0d15-0410-975c-d299462d15a1
This commit is contained in:
dave 2006-06-12 17:57:01 +00:00
parent 469a35b785
commit da73e3fc74
7 changed files with 10 additions and 7 deletions

View File

@ -80,6 +80,7 @@ PatchModel::remove_node(const string& name)
if (i != m_nodes.end()) {
//delete i->second;
m_nodes.erase(i);
removed_node_sig.emit(name);
return;
}

View File

@ -71,6 +71,7 @@ public:
// Signals
sigc::signal<void, CountedPtr<NodeModel> > new_node_sig;
sigc::signal<void, const string& > removed_node_sig;
sigc::signal<void, CountedPtr<ConnectionModel> > new_connection_sig;
sigc::signal<void, const string&, const string& > removed_connection_sig;

View File

@ -149,7 +149,7 @@ QueuedEngineInterface::rename(const string& old_path,
void
QueuedEngineInterface::destroy(const string& path)
{
DestroyEvent* ev = new DestroyEvent(_responder, path);
DestroyEvent* ev = new DestroyEvent(_responder, this, path);
push(ev);
}

View File

@ -70,7 +70,7 @@ protected:
: Event(responder), m_pre_processed(false), m_blocking(blocking), m_source(source)
{}
// NULL event base (for internal events)
// NULL event base (for internal events only!)
QueuedEvent()
: Event(), m_pre_processed(false), m_blocking(false), m_source(NULL)
{}

View File

@ -35,8 +35,8 @@
namespace Om {
DestroyEvent::DestroyEvent(CountedPtr<Responder> responder, const string& path, bool lock_mutex)
: QueuedEvent(responder, true),
DestroyEvent::DestroyEvent(CountedPtr<Responder> responder, QueuedEventSource* source, const string& path, bool lock_mutex)
: QueuedEvent(responder, true, source),
m_path(path),
m_node(NULL),
m_patch_listnode(NULL),
@ -142,6 +142,7 @@ DestroyEvent::execute(samplecount offset)
void
DestroyEvent::post_process()
{
assert(m_source);
m_source->unblock();
if (m_node == NULL) {

View File

@ -44,7 +44,7 @@ class DisconnectPortEvent;
class DestroyEvent : public QueuedEvent
{
public:
DestroyEvent(CountedPtr<Responder> responder, const string& path, bool lock_mutex = true);
DestroyEvent(CountedPtr<Responder> responder, QueuedEventSource* source, const string& path, bool lock_mutex = true);
DestroyEvent(CountedPtr<Responder> responder, Node* node, bool lock_mutex = true);
~DestroyEvent();

View File

@ -71,6 +71,7 @@ PatchController::PatchController(CountedPtr<PatchModel> model)
}*/
model->new_node_sig.connect(sigc::mem_fun(this, &PatchController::add_node));
model->removed_node_sig.connect(sigc::mem_fun(this, &PatchController::remove_node));
model->new_connection_sig.connect(sigc::mem_fun(this, &PatchController::connection));
model->removed_connection_sig.connect(sigc::mem_fun(this, &PatchController::disconnection));
}
@ -483,6 +484,7 @@ void
PatchController::remove_node(const string& name)
{
assert(name.find("/") == string::npos);
assert(!m_patch_model->get_node(name));
// Update breadcrumbs if necessary
if (m_window != NULL)
@ -492,8 +494,6 @@ PatchController::remove_node(const string& name)
assert(m_patch_view->canvas() != NULL);
m_patch_view->canvas()->remove_module(name);
}
patch_model()->remove_node(name);
}