InfoBar: Do not synchronously delete widgets in update

Deleting the widgets can trigger use after free errors if those widgets
are stil supposed to handle events.
This can for instance be observed with an ASAN build of Qt when pressing
the "Link Qt" button - the button still has a pending MouseReleaseEvent,
when update is called, and by deleting the InfoBarWidget that contains
the button, we run into the use-after-free.

That might also be relevant to the comment about a "complictated crash"
in infoBarDestroyed.

Change-Id: I9f807aa26db1169a5a749692922e580dc5874254
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Fabian Kosmale
2022-11-25 15:32:32 +01:00
parent 133099aa81
commit d15c102af8

View File

@@ -268,7 +268,7 @@ void InfoBarDisplay::update()
{
for (QWidget *widget : std::as_const(m_infoWidgets)) {
widget->disconnect(this); // We want no destroyed() signal now
delete widget;
widget->deleteLater();
}
m_infoWidgets.clear();