summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-02-16 04:39:34 +0000
committerDavid Robillard <d@drobilla.net>2009-02-16 04:39:34 +0000
commit93d7040d046f793d7908ff301910874c10012edd (patch)
tree11142af8017f4bd4fa70b6013fabad673833cb0b /libs
parent3963d2b0b224e79fdf8e852e39fc3a765fa1431b (diff)
Fix deadlock issues.
Add IdentityConverter for when no conversion is actually needed. git-svn-id: svn://localhost/ardour2/branches/3.0@4595 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/evoral/evoral/TimeConverter.hpp9
-rw-r--r--libs/evoral/src/Sequence.cpp11
2 files changed, 15 insertions, 5 deletions
diff --git a/libs/evoral/evoral/TimeConverter.hpp b/libs/evoral/evoral/TimeConverter.hpp
index 3f434d9dd7..eabe0e4762 100644
--- a/libs/evoral/evoral/TimeConverter.hpp
+++ b/libs/evoral/evoral/TimeConverter.hpp
@@ -38,6 +38,15 @@ public:
virtual A from(B b) const = 0;
};
+
+/** A stub TimeConverter that simple statically casts between types. */
+template<typename A, typename B>
+class IdentityConverter : public TimeConverter<A,B> {
+ B to(A a) const { return static_cast<B>(a); }
+ A from(B b) const { return static_cast<A>(b); }
+};
+
+
} // namespace Evoral
#endif // EVORAL_TIME_CONVERTER_HPP
diff --git a/libs/evoral/src/Sequence.cpp b/libs/evoral/src/Sequence.cpp
index ac0ca231f1..d11988e70c 100644
--- a/libs/evoral/src/Sequence.cpp
+++ b/libs/evoral/src/Sequence.cpp
@@ -191,12 +191,10 @@ Sequence<Time>::const_iterator::const_iterator(const Sequence<Time>& seq, Time t
if (!_event || _event->size() == 0) {
DUMP(format("Starting at end @ %1%\n") % t);
- _is_end = true;
_type = NIL;
- if (_locked) {
- _seq->read_unlock();
- _locked = false;
- }
+ _is_end = true;
+ _locked = false;
+ _seq->read_unlock();
} else {
DUMP(format("New iterator = %1% : %2% @ %3%\n")
% (int)_event->event_type()
@@ -371,6 +369,8 @@ Sequence<Time>::const_iterator::operator=(const const_iterator& other)
if (other._locked) {
other._seq->read_lock();
}
+ } else if (!_locked && other._locked) {
+ _seq->read_lock();
}
_seq = other._seq;
@@ -582,6 +582,7 @@ Sequence<Time>::append(const Event<Time>& event)
if (!midi_event_is_valid(ev.buffer(), ev.size())) {
cerr << "WARNING: Sequence ignoring illegal MIDI event" << endl;
+ write_unlock();
return;
}