From e8904251a8758c11ae8fa9b9f7adcd575833f23a Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Wed, 21 May 2014 15:37:43 +0200 Subject: Fix crash when resizing a window in brcm-egl This occurs for example when a Qt Quick2 application calls showFullScreen() while a rendering is already in progress. The GUI thread was calling destroyEglSurfaces() from setGeometry() and thus destroying the buffers, while the render thread was trying to use the buffers from swapBuffers(). There was a division by zero in swapBuffers() with the modulo m_count operation, because EGL surfaces were destroyed and m_count was 0. This fix is quite fragile, proper locking on buffers would be better. Change-Id: I41fcb2fcebec84c0dfc82ce56c6e323d3722b30a Reviewed-by: Laszlo Agocs --- src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp index 3d3fdad20..7cead1dc7 100644 --- a/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp +++ b/src/hardwareintegration/client/brcm-egl/qwaylandbrcmeglwindow.cpp @@ -243,6 +243,9 @@ void QWaylandBrcmEglWindow::swapBuffers() glFinish(); } + if (!m_count) + return; + m_buffers[m_current]->bind(); attach(m_buffers[m_current], 0, 0); damage(QRect(QPoint(), geometry().size())); -- cgit v1.2.3