summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@digia.com>2014-09-11 15:41:05 +0200
committerhjk <hjk121@nokiamail.com>2014-09-12 15:36:18 +0200
commit165f759e184b28be8bb071e6ed3308436e404238 (patch)
tree206dba9b50d7e25baa06f5af2bb02eaa5580b2a6
parent602746950b8f6269ae03a7886320425d3dfbfc86 (diff)
downloadqt-creator-165f759e184b28be8bb071e6ed3308436e404238.tar.gz
Editors: sync the layout with the contents before setting text cursor
Not doing this makes the QPlainTextEdit interact with an invalid layout, potentially causing crashes. Now the cursor setting itself is not part of the undo stack anymore, but as undoing sets the cursor itself, that shouldn't be a problem. Change-Id: Ic6f8ee9781faed655ac20f058b562c098ced20ae Task-number: QTCREATORBUG-12987 Reviewed-by: hjk <hjk121@nokiamail.com>
-rw-r--r--src/libs/utils/uncommentselection.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libs/utils/uncommentselection.cpp b/src/libs/utils/uncommentselection.cpp
index 21a4756c50..319ebea1c2 100644
--- a/src/libs/utils/uncommentselection.cpp
+++ b/src/libs/utils/uncommentselection.cpp
@@ -223,6 +223,8 @@ void Utils::unCommentSelection(QPlainTextEdit *edit, const CommentDefinition &de
}
}
+ cursor.endEditBlock();
+
// adjust selection when commenting out
if (hasSelection && !doMultiLineStyleUncomment && !doSingleLineStyleUncomment) {
cursor = edit->textCursor();
@@ -238,6 +240,4 @@ void Utils::unCommentSelection(QPlainTextEdit *edit, const CommentDefinition &de
}
edit->setTextCursor(cursor);
}
-
- cursor.endEditBlock();
}