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