summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/PatchageCanvas.cpp18
-rw-r--r--src/PatchageCanvas.hpp3
-rw-r--r--src/PatchageModule.cpp1
3 files changed, 5 insertions, 17 deletions
diff --git a/src/PatchageCanvas.cpp b/src/PatchageCanvas.cpp
index d20add5..7021d89 100644
--- a/src/PatchageCanvas.cpp
+++ b/src/PatchageCanvas.cpp
@@ -68,7 +68,6 @@ PatchageCanvas::remove_module(const string& name)
{
ModuleIndex::iterator i = _module_index.find(name);
while (i != _module_index.end()) {
- delete i->second;
_module_index.erase(i);
i = _module_index.find(name);
}
@@ -335,28 +334,17 @@ PatchageCanvas::make_connection(FlowCanvas::Node* tail,
return true;
}
-bool
-PatchageCanvas::remove_item(FlowCanvasNode* i)
+void
+PatchageCanvas::remove_module(PatchageModule* module)
{
- // Remove item from canvas
- const bool ret = FlowCanvas::Canvas::remove_item(i);
- if (!ret)
- return ret;
-
- PatchageModule* const module = dynamic_cast<PatchageModule*>(Glib::wrap(i));
- if (!module)
- return ret;
-
// Remove module from cache
for (ModuleIndex::iterator i = _module_index.find(module->get_label());
i != _module_index.end() && i->first == module->get_label(); ++i) {
if (i->second == module) {
_module_index.erase(i);
- return true;
+ return;
}
}
-
- return ret;
}
void
diff --git a/src/PatchageCanvas.hpp b/src/PatchageCanvas.hpp
index af46615..cf536ba 100644
--- a/src/PatchageCanvas.hpp
+++ b/src/PatchageCanvas.hpp
@@ -45,6 +45,7 @@ public:
PatchagePort* find_port(const PortID& id);
void remove_module(const std::string& name);
+ void remove_module(PatchageModule* module);
PatchagePort* find_port_by_name(const std::string& client_name,
const std::string& port_name);
@@ -74,8 +75,6 @@ public:
private:
Patchage* _app;
- bool remove_item(FlowCanvasNode* i);
-
bool on_event(GdkEvent* ev);
bool on_connection_event(FlowCanvas::Edge* c, GdkEvent* ev);
diff --git a/src/PatchageModule.cpp b/src/PatchageModule.cpp
index 6ebf335..2d53a27 100644
--- a/src/PatchageModule.cpp
+++ b/src/PatchageModule.cpp
@@ -32,6 +32,7 @@ PatchageModule::PatchageModule(
PatchageModule::~PatchageModule()
{
+ _app->canvas()->remove_module(this);
delete _menu;
_menu = NULL;
}