From 52f5c887cf8d4149278d137684f8f1ee31231d65 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 14 Jun 2006 04:55:18 +0000 Subject: Node destruction working git-svn-id: http://svn.drobilla.net/lad/grauph@36 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/client/Store.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/libs/client/Store.cpp b/src/libs/client/Store.cpp index 56c6654f..d1555f4d 100644 --- a/src/libs/client/Store.cpp +++ b/src/libs/client/Store.cpp @@ -164,7 +164,31 @@ Store::add_plugin(CountedPtr 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 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(object); + if (node) { + cerr << "Node\n"; + PatchModel* const parent = dynamic_cast(object->parent().get()); + if (parent) + parent->remove_node(node->name()); + } + + PortModel* const port = dynamic_cast(object); + if (port) { + NodeModel* const parent = dynamic_cast(object->parent().get()); + assert(parent); + parent->remove_port(port->name()); + } + // FIXME: emit signals } -- cgit v1.2.1