iOS: Make sure FBOs are cleaned up in the right QIOSContext

655687d84d shuffled things around, moving the logic to connect
to the window's destroyed signal from backingFramebufferObjectFor into
makeCurrent. Unfortunately backingFramebufferObjectFor was the one taking
care of recursing into the root context (when shared contexts were in
play), so the end result was that the root context were keeping track
of the FBO, but the leaf context was trying to clean up the FBO.

Task-number: QTBUG-56653
Change-Id: I80ed71a3dedeb7611b2aa7548d94b9fbe0e20763
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
bb10
Tor Arne Vestbø 2017-11-21 14:32:50 +01:00
parent 68733e307f
commit d8288d2b65
1 changed files with 7 additions and 4 deletions

View File

@ -165,8 +165,6 @@ bool QIOSContext::makeCurrent(QPlatformSurface *surface)
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER,
framebufferObject.depthRenderbuffer);
}
connect(static_cast<QIOSWindow *>(surface), SIGNAL(destroyed(QObject*)), this, SLOT(windowDestroyed(QObject*)));
} else {
glBindFramebuffer(GL_FRAMEBUFFER, framebufferObject.handle);
}
@ -249,8 +247,13 @@ QIOSContext::FramebufferObject &QIOSContext::backingFramebufferObjectFor(QPlatfo
// should probably use QOpenGLMultiGroupSharedResource to track the shared default-FBOs.
if (m_sharedContext)
return m_sharedContext->backingFramebufferObjectFor(surface);
else
return m_framebufferObjects[surface];
if (!m_framebufferObjects.contains(surface)) {
// We're about to create a new FBO, make sure it's cleaned up as well
connect(static_cast<QIOSWindow *>(surface), SIGNAL(destroyed(QObject*)), this, SLOT(windowDestroyed(QObject*)));
}
return m_framebufferObjects[surface];
}
GLuint QIOSContext::defaultFramebufferObject(QPlatformSurface *surface) const