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-07-31 19:39:58 +0200
commit54d32ff902292148bffa84b7fc94116d32d5d02b (patch)
tree89940c8fbdfee72c8bef7084357485d41c0f93bd /src/quick/items/context2d/qquickcontext2dtexture.cpp
parent9fe218ddf604a9a31e25b55445b03ea47edc0b96 (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 0ab76b0ca5..fbfd3df324 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;
- QOpenGLContext::currentContext()->functions()->glDeleteTextures(2, m_displayTextures);
+ if (QOpenGLContext::currentContext())
+ QOpenGLContext::currentContext()->functions()->glDeleteTextures(2, m_displayTextures);
}
QSGTexture *QQuickContext2DFBOTexture::textureForNextFrame(QSGTexture *lastTexture)