summaryrefslogtreecommitdiffstats
path: root/src/server/events
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-03-15 16:36:12 +0000
committerDavid Robillard <d@drobilla.net>2014-03-15 16:36:12 +0000
commit06af6bea1308d4fbf82f54ea4e7c6f8c8c33b3bd (patch)
tree7bfb3d8edebe4c084dd62f0179da279e5233e505 /src/server/events
parentedc21257bcaaae3828a4274b680791aa55d66027 (diff)
downloadingen-06af6bea1308d4fbf82f54ea4e7c6f8c8c33b3bd.tar.gz
ingen-06af6bea1308d4fbf82f54ea4e7c6f8c8c33b3bd.tar.bz2
ingen-06af6bea1308d4fbf82f54ea4e7c6f8c8c33b3bd.zip
Hopefully fix potential deadlocks with mass deletes (fix #962).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@5336 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/events')
-rw-r--r--src/server/events/Delete.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp
index f21e0faf..993530a8 100644
--- a/src/server/events/Delete.cpp
+++ b/src/server/events/Delete.cpp
@@ -64,8 +64,6 @@ Delete::pre_process()
return Event::pre_process_done(Status::NOT_DELETABLE, _path);
}
- _lock.acquire();
-
_removed_bindings = _engine.control_bindings()->remove(_path);
Store::iterator iter = _engine.store()->find(_path);
@@ -86,6 +84,8 @@ Delete::pre_process()
return Event::pre_process_done(Status::INTERNAL_ERROR, _path);
}
+ _lock.acquire();
+
_engine.store()->remove(iter, _removed_objects);
if (_block) {
@@ -118,6 +118,10 @@ Delete::pre_process()
void
Delete::execute(ProcessContext& context)
{
+ if (_status != Status::SUCCESS) {
+ return;
+ }
+
if (_disconnect_event) {
_disconnect_event->execute(context);
}
@@ -141,7 +145,10 @@ Delete::execute(ProcessContext& context)
void
Delete::post_process()
{
- _lock.release();
+ if (_lock.locked()) {
+ _lock.release();
+ }
+
_removed_bindings.reset();
Broadcaster::Transfer t(*_engine.broadcaster());