]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/track.cpp
Improve block recreation algorithms
[r2c2.git] / source / libr2c2 / track.cpp
index 4708db5d40de6c79d26de28ef61af696afe6f48d..7a1746716574abdbedb40c0356042ae7932dba66 100644 (file)
@@ -344,9 +344,14 @@ bool Track::break_link(unsigned i)
                return false;
 
        links[i] = 0;
-       other->break_link(*this);
-       // XXX Creates the blocks twice, because the other track calls this too
-       layout.create_blocks(*this);
+       if(!other->break_link(*this))
+       {
+               /* If the call doesn't succeed, it means that the other track already
+               broke the link and is calling us right now.  Recreate blocks in the inner
+               call so it occurs before any signals are emitted. */
+               layout.create_blocks(*this);
+       }
+
        signal_link_changed.emit(i, 0);
 
        return true;