From 05ef0d9cb9422b98f51ad4ae285a33f9a4d1b94c Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 7 Nov 2023 15:59:22 +0100 Subject: [PATCH] Fix crash in QmlOutline related to QmlDesigner This is a workaround for the ugly hack that QmlDesigner forces the EditorManager to send a currentEditorChanged signal with QmlDesigner's custom, internal IEditor. The currentEditorChanged signal triggered an update/re-creation of the outline widget *for that editor*. Which is not the intended result in the first place, but even aggrevated by the fact that QmlDesigner never calls currentEditorChanged with the actual EditorManager::currentEditor() again. Work around that by only ever using the EditorManager::currentEditor() for the outline widget. Fixes: QTCREATORBUG-29653 Fixes: QTCREATORBUG-29702 Change-Id: I39c5bee94141a0d86c0e92879eb8b1c2b7ba64b9 Reviewed-by: Reviewed-by: Christian Stenger Reviewed-by: David Schulz --- src/plugins/texteditor/outlinefactory.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/texteditor/outlinefactory.cpp b/src/plugins/texteditor/outlinefactory.cpp index 2c462127026..8c736a45396 100644 --- a/src/plugins/texteditor/outlinefactory.cpp +++ b/src/plugins/texteditor/outlinefactory.cpp @@ -120,8 +120,10 @@ OutlineWidgetStack::OutlineWidgetStack(OutlineFactory *factory) : m_toggleSort->setToolTip(Tr::tr("Sort Alphabetically")); connect(m_toggleSort, &QAbstractButton::clicked, this, &OutlineWidgetStack::toggleSort); - connect(Core::EditorManager::instance(), &Core::EditorManager::currentEditorChanged, - this, &OutlineWidgetStack::updateEditor); + connect(Core::EditorManager::instance(), + &Core::EditorManager::currentEditorChanged, + this, + &OutlineWidgetStack::updateCurrentEditor); connect(factory, &OutlineFactory::updateOutline, this, &OutlineWidgetStack::updateCurrentEditor); updateCurrentEditor();