forked from qt-creator/qt-creator
C++: Fix dangling IDocument* in CppCompletionAssistProcessor
Steps to reproduce the crash: 1. Open some long file, e.g. botan.cpp 2. Trigger completion and close editor immediately The IDocument pointer was only used to reference the file name. Instead of passing an IDocument* to the IAssistInterface, pass the file name. Change-Id: Iafce9b818806a77968a10541114bc9b7c8665f11 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com> Reviewed-by: David Schulz <david.schulz@digia.com>
This commit is contained in:
@@ -530,7 +530,7 @@ IAssistProposal *QmlJSCompletionAssistProcessor::perform(const IAssistInterface
|
||||
if (assistInterface->reason() == IdleEditor && !acceptsIdleEditor())
|
||||
return 0;
|
||||
|
||||
const QString &fileName = m_interface->document()->fileName();
|
||||
const QString &fileName = m_interface->fileName();
|
||||
|
||||
m_startPosition = assistInterface->position();
|
||||
while (isIdentifierChar(m_interface->textDocument()->characterAt(m_startPosition - 1), false, false))
|
||||
@@ -964,10 +964,10 @@ bool QmlJSCompletionAssistProcessor::completeUrl(const QString &relativeBasePath
|
||||
// ------------------------------
|
||||
QmlJSCompletionAssistInterface::QmlJSCompletionAssistInterface(QTextDocument *textDocument,
|
||||
int position,
|
||||
Core::IDocument *document,
|
||||
const QString &fileName,
|
||||
TextEditor::AssistReason reason,
|
||||
const SemanticInfo &info)
|
||||
: DefaultAssistInterface(textDocument, position, document, reason)
|
||||
: DefaultAssistInterface(textDocument, position, fileName, reason)
|
||||
, m_semanticInfo(info)
|
||||
, m_darkBlueIcon(iconForColor(Qt::darkBlue))
|
||||
, m_darkYellowIcon(iconForColor(Qt::darkYellow))
|
||||
|
||||
Reference in New Issue
Block a user