diff options
author | David Robillard <d@drobilla.net> | 2010-02-18 09:01:47 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-02-18 09:01:47 +0000 |
commit | d733603ea25388c6ebb288a5e8a3354b7ed1954f (patch) | |
tree | 3989da107e3dfb2b9abf7f338be6bab53ad51ada /src | |
parent | 120205ca446ee280f8608a9bf3113d3fdebf445d (diff) | |
download | ingen-d733603ea25388c6ebb288a5e8a3354b7ed1954f.tar.gz ingen-d733603ea25388c6ebb288a5e8a3354b7ed1954f.tar.bz2 ingen-d733603ea25388c6ebb288a5e8a3354b7ed1954f.zip |
Refuse to delete /control_in or /control_out (fix crashes e.g. select-all + delete).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2464 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/events/Delete.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/engine/events/Delete.cpp b/src/engine/events/Delete.cpp index 82681c08..27f1b995 100644 --- a/src/engine/events/Delete.cpp +++ b/src/engine/events/Delete.cpp @@ -63,6 +63,11 @@ Delete::~Delete() void Delete::pre_process() { + if (_path.is_root() || _path == "path:/control_in" || _path == "path:/control_out") { + QueuedEvent::pre_process(); + return; + } + _removed_bindings = _engine.control_bindings()->remove(_path); _store_iterator = _engine.engine_store()->find(_path); @@ -168,16 +173,12 @@ Delete::post_process() { _removed_bindings.reset(); - if (!_node && !_port) { - if (_path.is_root()) { - _request->respond_error("You can not destroy the root patch (/)"); - } else { - string msg = string("Could not find object ") + _path.str() + " to destroy"; - _request->respond_error(msg); - } - } - - if (_patch_node_listnode) { + if (_path.is_root() || _path == "path:/control_in" || _path == "path:/control_out") { + _request->respond_error(_path.chop_scheme() + " can not be deleted"); + } else if (!_node && !_port) { + string msg = string("Could not find object ") + _path.chop_scheme() + " to delete"; + _request->respond_error(msg); + } else if (_patch_node_listnode) { assert(_node); _node->deactivate(); _request->respond_ok(); @@ -197,7 +198,7 @@ Delete::post_process() _engine.broadcaster()->bundle_end(); _engine.maid()->push(_patch_port_listnode); } else { - _request->respond_error("Unable to destroy object"); + _request->respond_error("Unable to delete object " + _path.chop_scheme()); } if (_driver_port) { |