aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/context2d/qquickcontext2dtexture.cpp
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@jollamobile.com>2014-07-30 17:11:02 +0200
committerGunnar Sletta <gunnar.sletta@jollamobile.com>2014-08-01 23:16:26 +0200
commit557d73575978b873bb01ea791ae237fa6067fa7f (patch)
treeaa08ef0b5293f344d2df963d9524f7f017f4022a /src/quick/items/context2d/qquickcontext2dtexture.cpp
parentba193b94c6822ba382e2dc69cae60c6833f5cc9d (diff)
Make canvas cleanup work propertly...
Depending on which mode we are in, we need to run cleanup on the right thread and in the right way. Image canvas doesn't contain any GL resources and can be nuked right away. The actual QSGTexture is managed by the node, so we don't need to worry about it. For FBO it is a bit more complicated. - Threaded: We create a cleanup handler that runs makeCurrent deleteTexture and doneCurrent and then release the surface on the GUI thread. - Immediate: Same as threaded, just right away - Cooperative: Schedule the texture to be deleted on the next sync. The Context doesn't have its own GL context in this case, so don't worry about it. Change-Id: I2d0ae7acfa05561faa52f3cacd767eb18cabaf02 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Diffstat (limited to 'src/quick/items/context2d/qquickcontext2dtexture.cpp')
-rw-r--r--src/quick/items/context2d/qquickcontext2dtexture.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/quick/items/context2d/qquickcontext2dtexture.cpp b/src/quick/items/context2d/qquickcontext2dtexture.cpp
index ca66bd7f5a..4007713152 100644
--- a/src/quick/items/context2d/qquickcontext2dtexture.cpp
+++ b/src/quick/items/context2d/qquickcontext2dtexture.cpp
@@ -414,7 +414,8 @@ QQuickContext2DFBOTexture::~QQuickContext2DFBOTexture()
delete m_multisampledFbo;
delete m_paint_device;
- glDeleteTextures(2, m_displayTextures);
+ if (QOpenGLContext::currentContext())
+ glDeleteTextures(2, m_displayTextures);
}
QSGTexture *QQuickContext2DFBOTexture::textureForNextFrame(QSGTexture *lastTexture)