diff --git a/src/plugins/wmf/evrd3dpresentengine.cpp b/src/plugins/wmf/evrd3dpresentengine.cpp index 42d0dea4ed209bace35bc5fba64c68daad69cf5e..9a508520efdabd19dd0fba64d67ea3e4e6cfd28b 100644 --- a/src/plugins/wmf/evrd3dpresentengine.cpp +++ b/src/plugins/wmf/evrd3dpresentengine.cpp @@ -184,8 +184,12 @@ D3DPresentEngine::~D3DPresentEngine() m_egl->destroySurface(m_eglDisplay, m_eglSurface); m_eglSurface = NULL; } - if (m_glTexture) - QOpenGLContext::currentContext()->functions()->glDeleteTextures(1, &m_glTexture); + if (m_glTexture) { + if (QOpenGLContext *current = QOpenGLContext::currentContext()) + current->functions()->glDeleteTextures(1, &m_glTexture); + else + qWarning() << "D3DPresentEngine: Cannot obtain GL context, unable to delete textures"; + } delete m_glContext; delete m_offscreenSurface; diff --git a/src/qtmultimediaquicktools/qsgvideonode_i420.cpp b/src/qtmultimediaquicktools/qsgvideonode_i420.cpp index 5b8b7ce8a0b70489d6ff9f939acdeeac0eeec179..17b4924d084b550fe61460cca3f22e77834fa267 100644 --- a/src/qtmultimediaquicktools/qsgvideonode_i420.cpp +++ b/src/qtmultimediaquicktools/qsgvideonode_i420.cpp @@ -227,8 +227,12 @@ QSGVideoMaterial_YUV420::QSGVideoMaterial_YUV420(const QVideoSurfaceFormat &form QSGVideoMaterial_YUV420::~QSGVideoMaterial_YUV420() { - if (!m_textureSize.isEmpty()) - QOpenGLContext::currentContext()->functions()->glDeleteTextures(Num_Texture_IDs, m_textureIds); + if (!m_textureSize.isEmpty()) { + if (QOpenGLContext *current = QOpenGLContext::currentContext()) + current->functions()->glDeleteTextures(Num_Texture_IDs, m_textureIds); + else + qWarning() << "QSGVideoMaterial_YUV420: Cannot obtain GL context, unable to delete textures"; + } } void QSGVideoMaterial_YUV420::bind()