summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/events
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-08-18 03:49:35 +0000
committerDavid Robillard <d@drobilla.net>2008-08-18 03:49:35 +0000
commitaf759288a2517f9acf4c28f79d9c43be0086a221 (patch)
treeb5852382a750fa5f8a6bc60f27edf9881960374f /src/libs/engine/events
parent77d608d6ca282795b348a615932b1abbd47b0472 (diff)
downloadingen-af759288a2517f9acf4c28f79d9c43be0086a221.tar.gz
ingen-af759288a2517f9acf4c28f79d9c43be0086a221.tar.bz2
ingen-af759288a2517f9acf4c28f79d9c43be0086a221.zip
More copy/paste and serialisation work.
Don't die on invalid path for set_property and set_variable (return error to client). Working paste to subpatches, paste of connected patch ports and modules. git-svn-id: http://svn.drobilla.net/lad/ingen@1428 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine/events')
-rw-r--r--src/libs/engine/events/SetMetadataEvent.cpp12
-rw-r--r--src/libs/engine/events/SetMetadataEvent.hpp2
2 files changed, 13 insertions, 1 deletions
diff --git a/src/libs/engine/events/SetMetadataEvent.cpp b/src/libs/engine/events/SetMetadataEvent.cpp
index b4ee00ff..341fa06c 100644
--- a/src/libs/engine/events/SetMetadataEvent.cpp
+++ b/src/libs/engine/events/SetMetadataEvent.cpp
@@ -17,6 +17,7 @@
#include "SetMetadataEvent.hpp"
#include <string>
+#include <boost/format.hpp>
#include "Responder.hpp"
#include "Engine.hpp"
#include "ClientBroadcaster.hpp"
@@ -37,6 +38,7 @@ SetMetadataEvent::SetMetadataEvent(
const string& key,
const Atom& value)
: QueuedEvent(engine, responder, timestamp)
+ , _error(NO_ERROR)
, _property(property)
, _path(path)
, _key(key)
@@ -49,6 +51,12 @@ SetMetadataEvent::SetMetadataEvent(
void
SetMetadataEvent::pre_process()
{
+ if (!Path::is_valid(_path)) {
+ _error = INVALID_PATH;
+ QueuedEvent::pre_process();
+ return;
+ }
+
_object = _engine.engine_store()->find_object(_path);
if (_object == NULL) {
QueuedEvent::pre_process();
@@ -75,7 +83,9 @@ SetMetadataEvent::execute(ProcessContext& context)
void
SetMetadataEvent::post_process()
{
- if (_object == NULL) {
+ if (_error == INVALID_PATH) {
+ _responder->respond_error((boost::format("Invalid path %1% setting %2%") % _path % _key).str());
+ } else if (_object == NULL) {
string msg = "Unable to find object ";
msg += _path;
_responder->respond_error(msg);
diff --git a/src/libs/engine/events/SetMetadataEvent.hpp b/src/libs/engine/events/SetMetadataEvent.hpp
index 9707ce56..f6f8d3c3 100644
--- a/src/libs/engine/events/SetMetadataEvent.hpp
+++ b/src/libs/engine/events/SetMetadataEvent.hpp
@@ -49,6 +49,8 @@ public:
void post_process();
private:
+ enum { NO_ERROR, INVALID_PATH } _error;
+
bool _property;
string _path;
string _key;