summaryrefslogtreecommitdiff
path: root/libs/ardour/location.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-01-02 23:54:06 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2013-01-02 23:54:06 +0000
commit67265c6d90b2a84300e99ac629f9516b4d43f07f (patch)
tree9883a6bbce4d4a422be93793169e82255458fd5c /libs/ardour/location.cc
parentbcab77225765a35217505ce668404ae8a8feb999 (diff)
various fixes for moving markers, fixes a crash reported by tim blechmann and also likely #5232 and #5241
git-svn-id: svn://localhost/ardour2/branches/3.0@13754 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/location.cc')
-rw-r--r--libs/ardour/location.cc32
1 files changed, 32 insertions, 0 deletions
diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc
index 96a289e06f..4586fbee26 100644
--- a/libs/ardour/location.cc
+++ b/libs/ardour/location.cc
@@ -105,6 +105,21 @@ Location::Location (Session& s, const XMLNode& node)
assert (_end >= 0);
}
+bool
+Location::operator== (const Location& other)
+{
+ if (_name != other._name ||
+ _start != other._start ||
+ _end != other._end ||
+ _bbt_start != other._bbt_start ||
+ _bbt_end != other._bbt_end ||
+ _flags != other._flags ||
+ _position_lock_style != other._position_lock_style) {
+ return false;
+ }
+ return true;
+}
+
Location*
Location::operator= (const Location& other)
{
@@ -140,6 +155,10 @@ Location::operator= (const Location& other)
int
Location::set_start (framepos_t s, bool force, bool allow_bbt_recompute)
{
+ if (s < 0) {
+ return -1;
+ }
+
if (_locked) {
return -1;
}
@@ -196,6 +215,10 @@ Location::set_start (framepos_t s, bool force, bool allow_bbt_recompute)
int
Location::set_end (framepos_t e, bool force, bool allow_bbt_recompute)
{
+ if (e < 0) {
+ return -1;
+ }
+
if (_locked) {
return -1;
}
@@ -224,6 +247,7 @@ Location::set_end (framepos_t e, bool force, bool allow_bbt_recompute)
}
if (e != _end) {
+
framepos_t const old = _end;
_end = e;
@@ -245,6 +269,10 @@ Location::set_end (framepos_t e, bool force, bool allow_bbt_recompute)
int
Location::set (framepos_t start, framepos_t end, bool allow_bbt_recompute)
{
+ if (start < 0 || end < 0) {
+ return -1;
+ }
+
/* check validity */
if (((is_auto_punch() || is_auto_loop()) && start >= end) || (!is_mark() && start > end)) {
return -1;
@@ -260,6 +288,10 @@ Location::set (framepos_t start, framepos_t end, bool allow_bbt_recompute)
int
Location::move_to (framepos_t pos)
{
+ if (pos < 0) {
+ return -1;
+ }
+
if (_locked) {
return -1;
}