Client xdg-shell: Fix crash when switching popups
The call to flushWindowSystemEvents() sometimes caused new popups to be shown in the middle of hiding another. I.e. if multiple events show and hide surfaces, they would be shown/hidden in opposite order of their corresponding events. QMenus sometimes suffered from this (can be seen with the qopenglwidget example from qtbase). When the flush was added 5 years ago in 70c578cb5, it was to "reduce the chances of seeing a bad frame". I don't see any rendering artifacts, though, and I can't find any bug report on it. So let's hope it's safe to remove the hack. [ChangeLog][QPA plugin] Fixed a crash that sometimes happened when switching popups. Also adds more info to the workaround warning message that appears when a popup grab is attempted and there already is another grabbing popup that is not the parent. Fixes: QTBUG-73524 Change-Id: Ibfcbb48c4bbe295c2be1a30add2d7e05cad398c5 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
parent
ff9e5830d3
commit
e1eec68742
@ -335,7 +335,14 @@ void QWaylandXdgSurfaceV6::setGrabPopup(QWaylandWindow *parent, QWaylandInputDev
|
||||
auto *top = m_shell->m_topmostGrabbingPopup;
|
||||
|
||||
if (top && top->m_xdgSurface != parentXdgSurface) {
|
||||
qCWarning(lcQpaWayland) << "setGrabPopup called for a surface that was not the topmost popup, positions might be off.";
|
||||
qCWarning(lcQpaWayland) << "setGrabPopup called with a parent," << parentXdgSurface
|
||||
<< "which does not match the current topmost grabbing popup,"
|
||||
<< top->m_xdgSurface << "According to the xdg-shell-v6 protocol, this"
|
||||
<< "is not allowed. The wayland QPA plugin is currently handling"
|
||||
<< "it by setting the parent to the topmost grabbing popup."
|
||||
<< "Note, however, that this may cause positioning errors and"
|
||||
<< "popups closing unxpectedly because xdg-shell-v6 mandate that child"
|
||||
<< "popups close before parents";
|
||||
parent = top->m_xdgSurface->m_window;
|
||||
}
|
||||
setPopup(parent);
|
||||
|
@ -369,7 +369,14 @@ void QWaylandXdgSurface::setGrabPopup(QWaylandWindow *parent, QWaylandInputDevic
|
||||
auto *top = m_shell->m_topmostGrabbingPopup;
|
||||
|
||||
if (top && top->m_xdgSurface != parentXdgSurface) {
|
||||
qCWarning(lcQpaWayland) << "setGrabPopup called for a surface that was not the topmost popup, positions might be off.";
|
||||
qCWarning(lcQpaWayland) << "setGrabPopup called with a parent," << parentXdgSurface
|
||||
<< "which does not match the current topmost grabbing popup,"
|
||||
<< top->m_xdgSurface << "According to the xdg-shell protocol, this"
|
||||
<< "is not allowed. The wayland QPA plugin is currently handling"
|
||||
<< "it by setting the parent to the topmost grabbing popup."
|
||||
<< "Note, however, that this may cause positioning errors and"
|
||||
<< "popups closing unxpectedly because xdg-shell mandate that child"
|
||||
<< "popups close before parents";
|
||||
parent = top->m_xdgSurface->m_window;
|
||||
}
|
||||
setPopup(parent);
|
||||
|
@ -395,14 +395,9 @@ void QWaylandWindow::setVisible(bool visible)
|
||||
// QWaylandShmBackingStore::beginPaint().
|
||||
} else {
|
||||
sendExposeEvent(QRect());
|
||||
// when flushing the event queue, it could contain a close event, in which
|
||||
// case 'this' will be deleted. When that happens, we must abort right away.
|
||||
QPointer<QWaylandWindow> deleteGuard(this);
|
||||
QWindowSystemInterface::flushWindowSystemEvents();
|
||||
if (!deleteGuard.isNull() && window()->type() == Qt::Popup)
|
||||
if (window()->type() == Qt::Popup)
|
||||
closePopups(this);
|
||||
if (!deleteGuard.isNull())
|
||||
reset();
|
||||
reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user