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 <paul.tvete@qt.io>
(cherry picked from commit 4a9a5e2f62935488b1eeb06cd5d69a168a5a9308)
This commit is contained in:
Johan Klokkhammer Helsing 2019-06-05 13:10:38 +02:00
parent 84c3fcffd9
commit 1c59778c10

View File

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