winrt: QWinRTEGLContext: add isValid functionality

QPlatformOpenGLContext::isValid always returns true
but it is possible that creation of the context fails
in QWinRTEGLContext. This case should be reflected in
isValid because other places (like QOpenGLContext::isValid())
rely on it and not having proper information about the
validity of the context might lead to crashes.

Task-number: QTBUG-67568
Change-Id: If989ca47cdf7b27c44961beee5d97a4647184b0a
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
bb10
Oliver Wolff 2018-04-12 13:59:51 +02:00
parent 26355be54d
commit a8906e3510
2 changed files with 7 additions and 0 deletions

View File

@ -354,6 +354,12 @@ QFunctionPointer QWinRTEGLContext::getProcAddress(const char *procName)
return eglGetProcAddress(procName);
}
bool QWinRTEGLContext::isValid() const
{
Q_D(const QWinRTEGLContext);
return d->eglContext != EGL_NO_CONTEXT;
}
EGLDisplay QWinRTEGLContext::display()
{
return g->eglDisplay;

View File

@ -60,6 +60,7 @@ public:
QSurfaceFormat format() const override;
QFunctionPointer getProcAddress(const char *procName) override;
bool isValid() const override;
static EGLDisplay display();
private: