Fix crash when calling setVisible for EGL windows twice within one slot

Task-number: QTBUG-63411
Change-Id: I56c367a1801d215e93bf195332272cfee300cdd8
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
Johan Klokkhammer Helsing 2018-02-28 14:12:34 +01:00 committed by Johan Helsing
parent 2804d35cb4
commit 91e81af14c

View File

@ -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