Reorder initialisation to prevent access to an uninitialised variable.
authorCarl Hetherington <carl@carlh.net>
Mon, 24 Aug 2009 18:20:10 +0000 (18:20 +0000)
committerCarl Hetherington <carl@carlh.net>
Mon, 24 Aug 2009 18:20:10 +0000 (18:20 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@5579 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/region_selection.cc

index 13e2bdb7f4a92aead3b291da08d1c8b60d6e5cef..59d74d933f3e199c57d6cc0af4b350294189dcb3 100644 (file)
@@ -48,11 +48,12 @@ RegionSelection::RegionSelection (const RegionSelection& other)
 {
        RegionView::RegionViewGoingAway.connect (mem_fun(*this, &RegionSelection::remove_it));
 
+       _current_start = other._current_start;
+       _current_end = other._current_end;
+       
        for (RegionSelection::const_iterator i = other.begin(); i != other.end(); ++i) {
                add (*i);
        }
-       _current_start = other._current_start;
-       _current_end = other._current_end;
 }
 
 /** operator= to set a RegionSelection to be the same as another.
@@ -65,12 +66,12 @@ RegionSelection::operator= (const RegionSelection& other)
 
                clear_all();
                
+               _current_start = other._current_start;
+               _current_end = other._current_end;
+               
                for (RegionSelection::const_iterator i = other.begin(); i != other.end(); ++i) {
                        add (*i);
                }
-
-               _current_start = other._current_start;
-               _current_end = other._current_end;
        }
 
        return *this;