summaryrefslogtreecommitdiffstats
path: root/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp')
-rw-r--r--src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp
index bb3ea6981a..6f71fb637f 100644
--- a/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp
+++ b/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp
@@ -71,6 +71,7 @@ QOpenGLCompositorBackingStore::QOpenGLCompositorBackingStore(QWindow *window)
: QPlatformBackingStore(window),
m_window(window),
m_bsTexture(0),
+ m_bsTextureContext(0),
m_textures(new QPlatformTextureList),
m_lockedWidgetTextures(0)
{
@@ -78,6 +79,14 @@ QOpenGLCompositorBackingStore::QOpenGLCompositorBackingStore(QWindow *window)
QOpenGLCompositorBackingStore::~QOpenGLCompositorBackingStore()
{
+ if (m_bsTexture) {
+ QOpenGLContext *ctx = QOpenGLContext::currentContext();
+ if (ctx && m_bsTextureContext && ctx->shareGroup() == m_bsTextureContext->shareGroup())
+ glDeleteTextures(1, &m_bsTexture);
+ else
+ qWarning("QOpenGLCompositorBackingStore: Texture is not valid in the current context");
+ }
+
delete m_textures;
}
@@ -89,6 +98,8 @@ QPaintDevice *QOpenGLCompositorBackingStore::paintDevice()
void QOpenGLCompositorBackingStore::updateTexture()
{
if (!m_bsTexture) {
+ m_bsTextureContext = QOpenGLContext::currentContext();
+ Q_ASSERT(m_bsTextureContext);
glGenTextures(1, &m_bsTexture);
glBindTexture(GL_TEXTURE_2D, m_bsTexture);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);