Fix broken QIOSContext setup due to missing 0-initialization of EAGLContext

Change-Id: Ia4dbb2e3b055a7899c4a3e02698c5776ea7f73ea
Reviewed-by: Mike Krus <mike.krus@kdab.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
This commit is contained in:
Tor Arne Vestbø 2015-12-10 17:45:26 +01:00
parent 824af4aac9
commit 2e8ff4ba1b
1 changed files with 4 additions and 3 deletions

View File

@ -45,14 +45,15 @@
QIOSContext::QIOSContext(QOpenGLContext *context)
: QPlatformOpenGLContext()
, m_sharedContext(static_cast<QIOSContext *>(context->shareHandle()))
, m_eaglContext(0)
, m_format(context->format())
{
m_format.setRenderableType(QSurfaceFormat::OpenGLES);
EAGLSharegroup *shareGroup = m_sharedContext ? [m_sharedContext->m_eaglContext sharegroup] : nil;
for (int version = m_format.majorVersion() == 1 ? kEAGLRenderingAPIOpenGLES1 : kEAGLRenderingAPIOpenGLES3;
version >= m_format.majorVersion() && !m_eaglContext; --version) {
const int preferredVersion = m_format.majorVersion() == 1 ? kEAGLRenderingAPIOpenGLES1 : kEAGLRenderingAPIOpenGLES3;
for (int version = preferredVersion; !m_eaglContext && version >= m_format.majorVersion(); --version)
m_eaglContext = [[EAGLContext alloc] initWithAPI:EAGLRenderingAPI(version) sharegroup:shareGroup];
}
if (m_eaglContext != nil) {
EAGLContext *originalContext = [EAGLContext currentContext];