Node destruction working

git-svn-id: http://svn.drobilla.net/lad@36 a436a847-0d15-0410-975c-d299462d15a1
This commit is contained in:
dave 2006-06-14 04:55:18 +00:00
parent dff01201c5
commit 30f91d315d
1 changed files with 25 additions and 1 deletions

View File

@ -164,7 +164,31 @@ Store::add_plugin(CountedPtr<PluginModel> pm)
void
Store::destruction_event(const string& path)
{
remove_object(path);
// I'm assuming the compiler will optimize out all these const
// pointers into one...
CountedPtr<ObjectModel> obj_ptr = remove_object(path);
ObjectModel* const object = obj_ptr.get();
// FIXME: Why does this need to be specific? Just make a remove_child
// for everything
// Succeeds for (Plugin) Nodes and Patches
NodeModel* const node = dynamic_cast<NodeModel*>(object);
if (node) {
cerr << "Node\n";
PatchModel* const parent = dynamic_cast<PatchModel* const>(object->parent().get());
if (parent)
parent->remove_node(node->name());
}
PortModel* const port = dynamic_cast<PortModel*>(object);
if (port) {
NodeModel* const parent = dynamic_cast<NodeModel* const>(object->parent().get());
assert(parent);
parent->remove_port(port->name());
}
// FIXME: emit signals
}