From 79037e46eeb00e20c5f3bbe7d0de4b702af86884 Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 5 Jun 2019 13:10:38 +0200 Subject: Client: Don't add all windows to activePopups Neither Qt::ToolTip nor Qt::Popup are single bits in Qt::WindowFlags, and do in fact include Qt::Window. This meant that when we or'ed them and did a bitwise and with QWindow::type(), we would match more types than just Qt::Popup and Qt::ToolTip. We would for instance get any Qt::Window as well, which meant the main window would be added to activePopups, leading to strange things happening, such as crashes and the main window closing unexpectedly. [ChangeLog][QPA plugin] Fixed a crash when closing multiple popups at once. Fixes: QTBUG-76124 Change-Id: I1a6a59e161a436604a7ac8ab824396481dc99a20 Reviewed-by: Paul Olav Tvete (cherry picked from commit af9ec8a76d7e62444fadb518256fc58723fe5186) --- dist/changes-5.13.0 | 1 + src/client/qwaylandwindow.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dist/changes-5.13.0 b/dist/changes-5.13.0 index 1b18ed8fd..2aa76ba85 100644 --- a/dist/changes-5.13.0 +++ b/dist/changes-5.13.0 @@ -109,3 +109,4 @@ information about a particular change. QScreen::name(), will now typically return "VGA-1", "WL-1", "DP-2", "HDMI-A-1" and similar instead of "Screen25", "Screen26", "Screen27" etc. (on supported compositors). + - Fixed a crash when closing multiple popups at once. diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index 4532bc236..8b2c12277 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -387,7 +387,7 @@ QWaylandScreen *QWaylandWindow::calculateScreenFromSurfaceEvents() const void QWaylandWindow::setVisible(bool visible) { if (visible) { - if (window()->type() & (Qt::Popup | Qt::ToolTip)) + if (window()->type() == Qt::Popup || window()->type() == Qt::ToolTip) activePopups << this; initWindow(); mDisplay->flushRequests(); -- cgit v1.2.3