commit 8910a8a1ccf46972ed123b82216e49e993ea7aef
Author: Jean-Marc Lasgouttes <[email protected]>
Date:   Fri Jun 23 19:44:54 2017 +0200

    Fixup 9c92494e1a486: avoid crash in Inset::dissolve()
    
    The code path when the inset is empty did not fixup the cursor
    position correctly.
    
    Part of bug #10667.
---
 src/Text.cpp |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/Text.cpp b/src/Text.cpp
index 3083485..483f945 100644
--- a/src/Text.cpp
+++ b/src/Text.cpp
@@ -1783,20 +1783,20 @@ bool Text::dissolveInset(Cursor & cur)
 
                pasteParagraphList(cur, plist, b.params().documentClassPtr(),
                                   b.errorList("Paste"));
-               // restore position
-               cur.pit() = min(cur.lastpit(), spit);
-               cur.pos() = min(cur.lastpos(), spos);
        }
 
        // delete the inset now
        inset_it.paragraph().eraseChar(inset_it.pos(), 
b.params().track_changes);
 
-       cur.forceBufferUpdate();
-
+       // restore position
+       cur.pit() = min(cur.lastpit(), spit);
+       cur.pos() = min(cur.lastpos(), spos);
        // Ensure the current language is set correctly (bug 6292)
        cur.text()->setCursor(cur, cur.pit(), cur.pos());
        cur.clearSelection();
        cur.resetAnchor();
+       cur.forceBufferUpdate();
+
        return true;
 }
 

Reply via email to