summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/builtineditordocumentprocessor.h
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@theqtcompany.com>2015-09-01 17:34:07 +0200
committerNikolai Kosjar <nikolai.kosjar@theqtcompany.com>2015-09-02 12:37:23 +0000
commit169556db2f63912b7eaa2375dbc17c52ffd57586 (patch)
treec2a4a979dfbdabc6c2d93a24e038a15b19f8bab5 /src/plugins/cpptools/builtineditordocumentprocessor.h
parentc504e56d0c7fafba4f8c15997e3927b5ca02adc5 (diff)
downloadqt-creator-169556db2f63912b7eaa2375dbc17c52ffd57586.tar.gz
C++: Fix crash after triggering completion and closing editor
Fix use-after-free for the following case: 1. Open an editor 2. Trigger a long processing completion (e.g. simulate with QThread::msleep in CppCompletionAssistInterface::getCppSpecifics) 3. ...and immediately close the editor (e.g. with Ctrl+W) 4. Wait until it crashes. The completion thread relied on the BuiltinEditorDocumentParser object, which is deleted once the editor is closed. Fixed by sharing the ownership of that object between the *EditorDocumentProcessor and the completion assist interface. This case came up when doing tests for the bug report below. Task-number: QTCREATORBUG-14991 Change-Id: I0b009229e68fc6b7838740858cdc41a32403fe6f Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
Diffstat (limited to 'src/plugins/cpptools/builtineditordocumentprocessor.h')
-rw-r--r--src/plugins/cpptools/builtineditordocumentprocessor.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/cpptools/builtineditordocumentprocessor.h b/src/plugins/cpptools/builtineditordocumentprocessor.h
index b0db31e009..8fb0fe0d6b 100644
--- a/src/plugins/cpptools/builtineditordocumentprocessor.h
+++ b/src/plugins/cpptools/builtineditordocumentprocessor.h
@@ -53,7 +53,7 @@ public:
void recalculateSemanticInfoDetached(bool force) override;
void semanticRehighlight() override;
CppTools::SemanticInfo recalculateSemanticInfo() override;
- BaseEditorDocumentParser *parser() override;
+ BaseEditorDocumentParser::Ptr parser() override;
CPlusPlus::Snapshot snapshot() override;
bool isParserRunning() const override;
@@ -66,7 +66,7 @@ private:
SemanticInfo::Source createSemanticInfoSource(bool force) const;
private:
- BuiltinEditorDocumentParser m_parser;
+ BuiltinEditorDocumentParser::Ptr m_parser;
QFuture<void> m_parserFuture;
CPlusPlus::Snapshot m_documentSnapshot;