Merge branch 'master' into windows
[ardour.git] / libs / pbd / pbd / sequence_property.h
index 7d94a4be6b941573de6dffeaa08b156f013b9679..b9d59724ddc56175fb6d9dab62ec1ea1ae352cb5 100644 (file)
@@ -32,6 +32,7 @@
 #include "pbd/property_basics.h"
 #include "pbd/property_list.h"
 #include "pbd/stateful_diff_command.h"
+#include "pbd/error.h"
 
 namespace PBD {
 
@@ -110,7 +111,7 @@ class SequenceProperty : public PropertyBase
 
        /** Get a representation of one of our items as XML.  The representation must be sufficient to
         *  restore the item's state later; an ID is ok if someone else is storing the item state,
-        *  otherwise it needs to be the full state.  The supplied node is an <Add> or <Remove>
+        *  otherwise it needs to be the full state.  The supplied node is an \<Add\> or \<Remove\>
         *  which this method can either add properties or children to.
         */
        virtual void get_content_as_xml (typename ChangeContainer::value_type, XMLNode &) const = 0;
@@ -199,9 +200,10 @@ class SequenceProperty : public PropertyBase
                for (XMLNodeList::const_iterator j = grandchildren.begin(); j != grandchildren.end(); ++j) {
 
                        typename Container::value_type v = get_content_from_xml (**j);
-                       assert (v);
-                       
-                       if ((*j)->name() == "Add") {
+
+                       if (!v) {
+                               warning << "undo transaction references an unknown object" << endmsg;
+                       } else if ((*j)->name() == "Add") {
                                p->_changes.added.insert (v);
                        } else if ((*j)->name() == "Remove") {
                                p->_changes.removed.insert (v);
@@ -211,7 +213,7 @@ class SequenceProperty : public PropertyBase
                return p;
         }
 
-       /** Given an <Add> or <Remove> node as passed into get_content_to_xml, obtain an item */
+       /** Given an \<Add\> or \<Remove\> node as passed into get_content_to_xml, obtain an item */
        virtual typename Container::value_type get_content_from_xml (XMLNode const & node) const = 0;
 
        void clear_owned_changes () {
@@ -229,7 +231,7 @@ class SequenceProperty : public PropertyBase
                }
        }
 
-        Container rlist() { return _val; }
+        Container rlist() const { return _val; }
 
        /* Wrap salient methods of Sequence
         */