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: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Eike Ziller
2023-11-07 15:59:22 +01:00
parent afc5395bd1
commit 05ef0d9cb9

View File

@@ -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();