diff options
author | David Robillard <d@drobilla.net> | 2010-01-29 04:35:48 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-01-29 04:35:48 +0000 |
commit | 96613df7830699dbbfb5c2d9fe3ebdb0598e6aca (patch) | |
tree | bb7278466fc9ae92be6b53fb2f6399754d15f842 /src/engine/ControlBindings.hpp | |
parent | 1b964e850bbe3207fe9a65849520634955d141f0 (diff) | |
download | ingen-96613df7830699dbbfb5c2d9fe3ebdb0598e6aca.tar.gz ingen-96613df7830699dbbfb5c2d9fe3ebdb0598e6aca.tar.bz2 ingen-96613df7830699dbbfb5c2d9fe3ebdb0598e6aca.zip |
Remove references to deleted ports with control bindings (fix crash when applying binding to deleted port).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2393 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/ControlBindings.hpp')
-rw-r--r-- | src/engine/ControlBindings.hpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/engine/ControlBindings.hpp b/src/engine/ControlBindings.hpp index 8477a0fa..8823ecb1 100644 --- a/src/engine/ControlBindings.hpp +++ b/src/engine/ControlBindings.hpp @@ -15,12 +15,13 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef CONTROL_BINDIGNS_HPP +#ifndef CONTROL_BINDINGS_HPP #define CONTROL_BINDINGS_HPP #include <stdint.h> #include <map> #include "raul/SharedPtr.hpp" +#include "raul/Path.hpp" #include "shared/LV2URIMap.hpp" namespace Ingen { @@ -32,15 +33,24 @@ class PortImpl; class ControlBindings { public: + typedef std::map<int8_t, PortImpl*> Bindings; + ControlBindings(Engine& engine, SharedPtr<Shared::LV2URIMap> map) : _engine(engine) , _map(map) , _learn_port(NULL) + , _bindings(new Bindings()) {} void learn(PortImpl* port); void process(ProcessContext& context, EventBuffer* buffer); + /** Remove all bindings for @a path or children of @a path. + * The caller must safely drop the returned reference in the + * post-processing thread after at least one process thread has run. + */ + SharedPtr<Bindings> remove(const Raul::Path& path); + private: Engine& _engine; SharedPtr<Shared::LV2URIMap> _map; @@ -49,8 +59,7 @@ private: void set_port_value(ProcessContext& context, PortImpl* port, int8_t cc_value); void bind(ProcessContext& context, int8_t cc_num); - typedef std::map<int8_t, PortImpl*> Bindings; - Bindings _bindings; + SharedPtr<Bindings> _bindings; }; } // namespace Ingen |