forked from qt-creator/qt-creator
Clang: Do not call built-in follow symbol with no document
CppEditor tests (the part which works with ClangCodeModel) showed that it's possible that QTextCursor might get document reset to the moment we try to call built-in follow symbol. That means that the editor widget is closed already. Check for the document to prevent such behavior. Change-Id: I2463f4688dc6fca7f701fba243ffc6e43a573b33 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
@@ -491,10 +491,13 @@ void FollowSymbolUnderCursor::findLink(
|
||||
{
|
||||
Link link;
|
||||
|
||||
int line = 0;
|
||||
int column = 0;
|
||||
QTextCursor cursor = data.cursor();
|
||||
QTextDocument *document = cursor.document();
|
||||
if (!document)
|
||||
return processLinkCallback(link);
|
||||
|
||||
int line = 0;
|
||||
int column = 0;
|
||||
Utils::Text::convertPosition(document, cursor.position(), &line, &column);
|
||||
const int positionInBlock = column - 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user