From 91e81af14cb0f6145b840db8dbb0c906f64f498b Mon Sep 17 00:00:00 2001 From: Johan Klokkhammer Helsing Date: Wed, 28 Feb 2018 14:12:34 +0100 Subject: [PATCH] Fix crash when calling setVisible for EGL windows twice within one slot Task-number: QTBUG-63411 Change-Id: I56c367a1801d215e93bf195332272cfee300cdd8 Reviewed-by: Paul Olav Tvete --- tests/auto/wayland/client/tst_client.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/auto/wayland/client/tst_client.cpp b/tests/auto/wayland/client/tst_client.cpp index 1e3d0f1d14d..05b8bac1afa 100644 --- a/tests/auto/wayland/client/tst_client.cpp +++ b/tests/auto/wayland/client/tst_client.cpp @@ -113,7 +113,10 @@ class TestGlWindow : public QOpenGLWindow public: TestGlWindow(); - uint paintGLCalled = 0; + int paintGLCalled = 0; + +public slots: + void hideShow(); protected: void paintGL() override; @@ -122,6 +125,12 @@ protected: TestGlWindow::TestGlWindow() {} +void TestGlWindow::hideShow() +{ + setVisible(false); + setVisible(true); +} + void TestGlWindow::paintGL() { glClear(GL_COLOR_BUFFER_BIT); @@ -564,7 +573,15 @@ void tst_WaylandClient::glWindow() QTRY_VERIFY(surface = compositor->surface()); compositor->sendShellSurfaceConfigure(surface); - QTRY_VERIFY(testWindow->paintGLCalled); + QTRY_COMPARE(testWindow->paintGLCalled, 1); + + //QTBUG-63411 + QMetaObject::invokeMethod(testWindow.data(), "hideShow", Qt::QueuedConnection); + testWindow->requestUpdate(); + QTRY_COMPARE(testWindow->paintGLCalled, 2); + + testWindow->requestUpdate(); + QTRY_COMPARE(testWindow->paintGLCalled, 3); //confirm we don't crash when we delete an already hidden GL window //QTBUG-65553