From d15c102af89b54987d8f7a7072cf8e9099fc0361 Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Fri, 25 Nov 2022 15:32:32 +0100 Subject: [PATCH] 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: Reviewed-by: Qt CI Bot Reviewed-by: Eike Ziller --- src/libs/utils/infobar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/utils/infobar.cpp b/src/libs/utils/infobar.cpp index 13fca918f53..ad615502a2e 100644 --- a/src/libs/utils/infobar.cpp +++ b/src/libs/utils/infobar.cpp @@ -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();