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:
Nikolai Kosjar
2013-03-18 14:58:46 +01:00
parent 7f61d11311
commit 947207c802
16 changed files with 29 additions and 27 deletions

View File

@@ -45,7 +45,8 @@ using namespace TextEditor;
// -----------------------
QmlJSQuickFixAssistInterface::QmlJSQuickFixAssistInterface(QmlJSTextEditorWidget *editor,
TextEditor::AssistReason reason)
: DefaultAssistInterface(editor->document(), editor->position(), editor->editorDocument(), reason)
: DefaultAssistInterface(editor->document(), editor->position(),
editor->editorDocument()->fileName(), reason)
, m_editor(editor)
, m_semanticInfo(editor->semanticInfo())
, m_currentFile(QmlJSRefactoringChanges::file(m_editor, m_semanticInfo.document))