QNX: Ensure that the QQnxWindow has a valid size for EGL surfaces
authorSean Harmer <sean.harmer.qnx@kdab.com>
Tue, 31 Jul 2012 13:09:15 +0000 (14:09 +0100)
committerQt by Nokia <qt-info@nokia.com>
Wed, 1 Aug 2012 13:37:46 +0000 (15:37 +0200)
If QWindow::create() gets called before resize() or setGeometry() then
the rect argument passed into QQnxWindow::setGeometry() by the ctor
is null.

This could potentially result in 0 sized buffers and EGL surface
creation being attempted. We bail out in this case and tell
user how to fix their application.

Change-Id: Ia709dba617fa266bd66b61409bdb1c980acfb1a2
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Reviewed-by: Kevin Ottens <kevin.ottens.qnx@kdab.com>
Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
src/plugins/platforms/qnx/qqnxglcontext.cpp

index 44935f7..7940156 100644 (file)
@@ -319,6 +319,10 @@ void QQnxGLContext::createSurface(QPlatformSurface *surface)
     // Fetch the surface size from the window and update
     // the window's buffers before we create the EGL surface
     const QSize surfaceSize = platformWindow->requestedBufferSize();
+    if (!surfaceSize.isValid()) {
+        qFatal("QQNX: Trying to create 0 size EGL surface. "
+               "Please set a valid window size before calling QOpenGLContext::makeCurrent()");
+    }
     platformWindow->setBufferSize(surfaceSize);
 
     // Obtain the native handle for our window