Don't flushWindowSystemEvents in QWaylandWindow ctor.

tests/auto/gui/kernel/qbackingstore test crashed because the
flush in QWaylandWindow::setWindowState invoked backing store
expose event handling which in turn tried to use related
(not yet created) QWaylandWindow.

Change-Id: Ic9f29cc3433e6e671deb756aebe26530ebc72042
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
This commit is contained in:
Tomasz Olszak 2014-01-14 21:29:08 +01:00 committed by The Qt Project
parent 60fd8b1612
commit 3a2ece17c3
2 changed files with 34 additions and 26 deletions

View File

@ -119,7 +119,7 @@ QWaylandWindow::QWaylandWindow(QWindow *window)
setWindowFlags(window->flags());
setGeometry(window->geometry());
setWindowState(window->windowState());
setWindowStateInternal(window->windowState());
}
QWaylandWindow::~QWaylandWindow()
@ -409,31 +409,8 @@ void QWaylandWindow::handleContentOrientationChange(Qt::ScreenOrientation orient
void QWaylandWindow::setWindowState(Qt::WindowState state)
{
if (mState == state) {
return;
}
// As of february 2013 QWindow::setWindowState sets the new state value after
// QPlatformWindow::setWindowState returns, so we cannot rely on QWindow::windowState
// here. We use then this mState variable.
mState = state;
createDecoration();
switch (state) {
case Qt::WindowFullScreen:
mShellSurface->setFullscreen();
break;
case Qt::WindowMaximized:
mShellSurface->setMaximized();
break;
case Qt::WindowMinimized:
mShellSurface->setMinimized();
break;
default:
mShellSurface->setNormal();
}
QWindowSystemInterface::handleWindowStateChanged(window(), mState);
QWindowSystemInterface::flushWindowSystemEvents(); // Required for oldState to work on WindowStateChanged
if (setWindowStateInternal(state))
QWindowSystemInterface::flushWindowSystemEvents(); // Required for oldState to work on WindowStateChanged
}
void QWaylandWindow::setWindowFlags(Qt::WindowFlags flags)
@ -605,4 +582,33 @@ bool QWaylandWindow::setMouseGrabEnabled(bool grab)
return true;
}
bool QWaylandWindow::setWindowStateInternal(Qt::WindowState state)
{
if (mState == state) {
return false;
}
// As of february 2013 QWindow::setWindowState sets the new state value after
// QPlatformWindow::setWindowState returns, so we cannot rely on QWindow::windowState
// here. We use then this mState variable.
mState = state;
createDecoration();
switch (state) {
case Qt::WindowFullScreen:
mShellSurface->setFullscreen();
break;
case Qt::WindowMaximized:
mShellSurface->setMaximized();
break;
case Qt::WindowMinimized:
mShellSurface->setMinimized();
break;
default:
mShellSurface->setNormal();
}
QWindowSystemInterface::handleWindowStateChanged(window(), mState);
return true;
}
QT_END_NAMESPACE

View File

@ -204,6 +204,8 @@ protected:
Qt::WindowState mState;
private:
bool setWindowStateInternal(Qt::WindowState flags);
void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice,
ulong timestamp,
const QPointF & local,