diff options
author | David Robillard <d@drobilla.net> | 2011-06-20 01:12:30 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-06-20 01:12:30 +0000 |
commit | 8b8e32c3fa8989d0997eeef340a2a39bbfdc2382 (patch) | |
tree | 3df954d0c3caf1c929a45451d3a5d734156522ae /src | |
parent | 01b04e0d5868ecebf16b9b2051227a8b2fd6e2e1 (diff) | |
download | patchage-8b8e32c3fa8989d0997eeef340a2a39bbfdc2382.tar.gz patchage-8b8e32c3fa8989d0997eeef340a2a39bbfdc2382.tar.bz2 patchage-8b8e32c3fa8989d0997eeef340a2a39bbfdc2382.zip |
Fix crashes on jack client exit.
git-svn-id: http://svn.drobilla.net/lad/trunk/patchage@3408 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/PatchageCanvas.cpp | 11 | ||||
-rw-r--r-- | src/PatchageCanvas.hpp | 2 | ||||
-rw-r--r-- | src/PatchageEvent.cpp | 5 |
3 files changed, 14 insertions, 4 deletions
diff --git a/src/PatchageCanvas.cpp b/src/PatchageCanvas.cpp index ebbfc39..fe9a26b 100644 --- a/src/PatchageCanvas.cpp +++ b/src/PatchageCanvas.cpp @@ -62,6 +62,17 @@ PatchageCanvas::find_module(const string& name, ModuleType type) return io_module; } +void +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); + } +} + PatchagePort* PatchageCanvas::find_port(const PortID& id) { diff --git a/src/PatchageCanvas.hpp b/src/PatchageCanvas.hpp index 1f5a58d..295dacf 100644 --- a/src/PatchageCanvas.hpp +++ b/src/PatchageCanvas.hpp @@ -45,6 +45,8 @@ public: PatchageModule* find_module(const std::string& name, ModuleType type); PatchagePort* find_port(const PortID& id); + void remove_module(const std::string& name); + PatchagePort* find_port_by_name(const std::string& client_name, const std::string& port_name); diff --git a/src/PatchageEvent.cpp b/src/PatchageEvent.cpp index b101e73..623b566 100644 --- a/src/PatchageEvent.cpp +++ b/src/PatchageEvent.cpp @@ -47,10 +47,7 @@ PatchageEvent::execute(Patchage* patchage) _str = NULL; } else if (_type == CLIENT_DESTRUCTION) { - PatchageModule* module = dynamic_cast<PatchageModule*>( - patchage->canvas()->find_module(_str, InputOutput)); - - delete module; + patchage->canvas()->remove_module(_str); free(_str); _str = NULL; |