Make AutomationLists clear their events when their state is set to an AutomationList...
authorCarl Hetherington <carl@carlh.net>
Tue, 20 Jul 2010 23:25:02 +0000 (23:25 +0000)
committerCarl Hetherington <carl@carlh.net>
Tue, 20 Jul 2010 23:25:02 +0000 (23:25 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@7456 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/automation_list.cc

index e785104367a1e7cd7939cd1837505aecb315d997..17f346db1da3833e5551c3bc4dd61ffcaa521f1c 100644 (file)
@@ -448,12 +448,25 @@ AutomationList::set_state (const XMLNode& node, int version)
                _max_xval = 0; // means "no limit ;
        }
 
+       bool have_events = false;
+       
        for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
                if ((*niter)->name() == X_("events")) {
                        deserialize_events (*(*niter));
+                       have_events = true;
                }
        }
 
+       if (!have_events) {
+               /* there was no Events child node; clear any current events */
+               freeze ();
+               clear ();
+               mark_dirty ();
+               reposition_for_rt_add (0);
+               maybe_signal_changed ();
+               thaw ();
+       }
+
        return 0;
 }