diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2022-11-25 15:32:32 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2022-11-28 08:34:34 +0000 |
commit | d15c102af89b54987d8f7a7072cf8e9099fc0361 (patch) | |
tree | 3ee06c185d31b95447c37e79b51fbc992f0f2515 | |
parent | 133099aa81c3d3ba0f7ec8f3490cbb3942b66966 (diff) |
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>
-rw-r--r-- | src/libs/utils/infobar.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libs/utils/infobar.cpp b/src/libs/utils/infobar.cpp index 13fca918f5..ad615502a2 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(); |