]> git.lyx.org Git - features.git/commitdiff
Fix assertion related to cursor anchor.
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sat, 27 Apr 2013 09:19:19 +0000 (11:19 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sat, 27 Apr 2013 09:19:19 +0000 (11:19 +0200)
src/Cursor.cpp

index 3ca61633a5bb0267327e9352108ed70e35c668f4..282087711b882f1e0be36ad3abfe8f245f918da9 100644 (file)
@@ -1139,14 +1139,12 @@ CursorSlice Cursor::normalAnchor() const
 {
        if (!selection())
                return top();
-       if (anchor_.depth() >= depth()) {
-               // LASSERT: There have been several bugs around this code, that seem
-               // to involve failures to reset the anchor. We can at least not crash
-               // in release mode by resetting it ourselves.
-               LASSERT(false, /* */);
-               DocIterator & di = const_cast<DocIterator &>(anchor_);
-               di = *this;
-       }
+       // LASSERT: There have been several bugs around this code, that seem
+       // to involve failures to reset the anchor. We can at least not crash
+       // in release mode by resetting it ourselves.
+       LASSERT(anchor_.depth() >= depth(), 
+               const_cast<DocIterator &>(anchor_) = *this);
+
        CursorSlice normal = anchor_[depth() - 1];
        if (depth() < anchor_.depth() && top() <= normal) {
                // anchor is behind cursor -> move anchor behind the inset