diff --git a/src/plugins/cppeditor/cppinsertdecldef.cpp b/src/plugins/cppeditor/cppinsertdecldef.cpp index 5a4e641a4d3..2d51b5849e5 100644 --- a/src/plugins/cppeditor/cppinsertdecldef.cpp +++ b/src/plugins/cppeditor/cppinsertdecldef.cpp @@ -81,7 +81,9 @@ public: void performChanges(CppRefactoringFile *, CppRefactoringChanges *refactoring) { - InsertionPointLocator locator(state().snapshot()); + Snapshot snapshot = state().snapshot(); + snapshot.insert(refactoring->file(m_targetFileName).cppDocument()); + InsertionPointLocator locator(snapshot); const InsertionLocation loc = locator.methodDeclarationInClass( m_targetFileName, m_targetSymbol, m_xsSpec); Q_ASSERT(loc.isValid());