CppEditor: Disconnect lambdas

Otherwise this can lead to use-after-free access, as in:

 1. Open a document
 2. Duplicate it the editor
 3. Close current editor
 4. Modify the preprocessor directives ('#' button)

Change-Id: I3032dbbfac86ad86e08dc39e85703bc176a27ca2
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Nikolai Kosjar
2017-02-03 11:41:26 +01:00
parent 38ba61ec4f
commit dd3ba874b4

View File

@@ -184,7 +184,7 @@ void CppEditorWidget::finalizeInitialization()
&d->m_localRenaming,
&CppLocalRenaming::updateSelectionsForVariableUnderCursor);
connect(&d->m_useSelectionsUpdater, &CppUseSelectionsUpdater::finished,
connect(&d->m_useSelectionsUpdater, &CppUseSelectionsUpdater::finished, this,
[this] (SemanticInfo::LocalUseMap localUses) {
QTC_CHECK(isSemanticInfoValidExceptLocalUses());
d->m_lastSemanticInfo.localUsesUpdated = true;
@@ -201,7 +201,7 @@ void CppEditorWidget::finalizeInitialization()
connect(this, &QPlainTextEdit::cursorPositionChanged,
d->m_cppEditorOutline, &CppEditorOutline::updateIndex);
connect(cppEditorDocument(), &CppEditorDocument::preprocessorSettingsChanged,
connect(cppEditorDocument(), &CppEditorDocument::preprocessorSettingsChanged, this,
[this](bool customSettings) {
d->m_preprocessorButton->setProperty("highlightWidget", customSettings);
d->m_preprocessorButton->update();
@@ -216,7 +216,7 @@ void CppEditorWidget::finalizeInitialization()
connect(this, &QPlainTextEdit::textChanged, this, &CppEditorWidget::updateFunctionDeclDefLink);
// set up the use highlighitng
connect(this, &CppEditorWidget::cursorPositionChanged, [this]() {
connect(this, &CppEditorWidget::cursorPositionChanged, this, [this]() {
if (!d->m_localRenaming.isActive())
d->m_useSelectionsUpdater.scheduleUpdate();