Editor: Avoid using private text document handle.

Task-number: QTCREATORBUG-15238
Change-Id: I6c7636ac4762c48c53767beaa97b0ce567f87dd1
Reviewed-by: hjk <hjk@theqtcompany.com>
This commit is contained in:
David Schulz
2016-02-01 15:28:38 +01:00
parent e432c715dd
commit 0532c94758

View File

@@ -92,8 +92,10 @@ void TextEditorOverlay::addOverlaySelection(int begin, int end,
selection.m_fg = fg;
selection.m_bg = bg;
selection.m_cursor_begin = QTextCursor(document->docHandle(), begin);
selection.m_cursor_end = QTextCursor(document->docHandle(), end);
selection.m_cursor_begin = QTextCursor(document);
selection.m_cursor_begin.setPos(begin);
selection.m_cursor_end = QTextCursor(document);
selection.m_cursor_end.setPos(end);
if (overlaySelectionFlags & ExpandBegin)
selection.m_cursor_begin.setKeepPositionOnInsert(true);