fix basic logic problem in PropertyTemplate<T>::set so that current/old values are...
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 28 Jun 2010 14:56:40 +0000 (14:56 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 28 Jun 2010 14:56:40 +0000 (14:56 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@7310 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/pbd/pbd/properties.h

index 03e42aa4517cda520549969419a344d142ace027..1e17ddafb0fb67cfebc0dd98c060e7de2b4ae0e7 100644 (file)
@@ -134,11 +134,24 @@ protected:
        {}
 
        void set (T const& v) {
-                if (!_have_old) {
-                        _old      = _current;
-                        _have_old = true;
-                }
-               _current  = v;
+                if (v != _current) {
+                        if (!_have_old) {
+                                _old = _current;
+                                _have_old = true;
+                        } else {
+                                if (v == _old) {
+                                        /* value has been reset to the value
+                                           at the start of a history transaction,
+                                           before clear_history() is called.
+                                           thus there is effectively no apparent
+                                           history for this property.
+                                        */
+                                        _have_old = false;
+                                }
+                        }
+
+                        _current  = v;
+                } 
        }
 
        virtual std::string to_string (T const& v) const             = 0;