[QNX] Handle the case when an egl surface can not be created
If an egl surface can not be created (e.g. when out of memory) the application should not crash. In this case we will not be able to make the egl surface current and have to return false in the makeCurrent call in QQnxGlContext. Change-Id: If9b5a82a0f64dc0a42bee687d351bea43fb05d51 Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>bb10
parent
74d84f32da
commit
c1c5aca6f1
|
|
@ -79,8 +79,9 @@ void QQnxEglWindow::createEGLSurface()
|
|||
// the window's buffers before we create the EGL surface
|
||||
const QSize surfaceSize = requestedBufferSize();
|
||||
if (!surfaceSize.isValid()) {
|
||||
qFatal("QQNX: Trying to create 0 size EGL surface. "
|
||||
qWarning("QQNX: Trying to create 0 size EGL surface. "
|
||||
"Please set a valid window size before calling QOpenGLContext::makeCurrent()");
|
||||
return;
|
||||
}
|
||||
setBufferSize(surfaceSize);
|
||||
|
||||
|
|
@ -98,7 +99,7 @@ void QQnxEglWindow::createEGLSurface()
|
|||
(EGLNativeWindowType) nativeHandle(), eglSurfaceAttrs);
|
||||
if (m_eglSurface == EGL_NO_SURFACE) {
|
||||
const EGLenum error = QQnxGLContext::checkEGLError("eglCreateWindowSurface");
|
||||
qFatal("QQNX: failed to create EGL surface, err=%d", error);
|
||||
qWarning("QQNX: failed to create EGL surface, err=%d", error);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -227,7 +227,8 @@ bool QQnxGLContext::makeCurrent(QPlatformSurface *surface)
|
|||
eglResult = eglMakeCurrent(ms_eglDisplay, m_currentEglSurface, m_currentEglSurface, m_eglContext);
|
||||
if (eglResult != EGL_TRUE) {
|
||||
checkEGLError("eglMakeCurrent");
|
||||
qFatal("QQNX: failed to set current EGL context, err=%d", eglGetError());
|
||||
qWarning("QQNX: failed to set current EGL context, err=%d", eglGetError());
|
||||
return false;
|
||||
}
|
||||
return (eglResult == EGL_TRUE);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue