Avoid an "OpenGL Error: 1282" output when resizing a QOpenGLWidget

When we delete the previous FBO in QOpenGLWidget::resizeEvent while
it is the currently bound FBO, the QOpenGLContextPrivate::current_fbo
will not be updated and will try to be bound during the initialization
of the new FBO.

Fix the issue by explicitly releasing the FBO on destruction if it
is current.

Change-Id: Id049889c4857526750bbecf3dd27343e44449c12
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
This commit is contained in:
Jocelyn Turcotte 2014-03-28 18:10:52 +01:00 committed by The Qt Project
parent f7971d37cb
commit b94493e6c8

View File

@ -890,6 +890,8 @@ QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, Attachment
QOpenGLFramebufferObject::~QOpenGLFramebufferObject()
{
Q_D(QOpenGLFramebufferObject);
if (isBound())
release();
if (d->texture_guard)
d->texture_guard->free();