diff options
-rw-r--r-- | src/quick/items/qquickwindow.cpp | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgcontext.cpp | 13 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgcontext_p.h | 2 |
3 files changed, 14 insertions, 3 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index d286ccff0c..532021932f 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -341,6 +341,8 @@ void QQuickWindowPrivate::syncSceneGraph() if (clearBeforeRendering) mode |= QSGRenderer::ClearColorBuffer; renderer->setClearMode(mode); + + context->endSync(); } diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index 1eeb9441b8..829d33a0d7 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -358,6 +358,12 @@ QSGRenderContext::~QSGRenderContext() invalidate(); } +void QSGRenderContext::endSync() +{ + qDeleteAll(m_texturesToDelete); + m_texturesToDelete.clear(); +} + static QBasicMutex qsg_framerender_mutex; void QSGRenderContext::renderNextFrame(QSGRenderer *renderer, GLuint fboId) @@ -475,6 +481,9 @@ void QSGRenderContext::invalidate() if (!m_gl) return; + qDeleteAll(m_texturesToDelete); + m_texturesToDelete.clear(); + qDeleteAll(m_textures.values()); m_textures.clear(); @@ -617,10 +626,8 @@ QSGTexture *QSGRenderContext::textureForFactory(QQuickTextureFactory *factory, Q void QSGRenderContext::textureFactoryDestroyed(QObject *o) { m_mutex.lock(); - QSGTexture *t = m_textures.take(static_cast<QQuickTextureFactory *>(o)); + m_texturesToDelete << m_textures.take(static_cast<QQuickTextureFactory *>(o)); m_mutex.unlock(); - if (t) - t->deleteLater(); } QT_END_NAMESPACE diff --git a/src/quick/scenegraph/qsgcontext_p.h b/src/quick/scenegraph/qsgcontext_p.h index c562a909c5..c1bf78a018 100644 --- a/src/quick/scenegraph/qsgcontext_p.h +++ b/src/quick/scenegraph/qsgcontext_p.h @@ -94,6 +94,7 @@ public: virtual void invalidate(); virtual void renderNextFrame(QSGRenderer *renderer, GLuint fboId); + virtual void endSync(); virtual QSharedPointer<QSGDepthStencilBuffer> depthStencilBufferForFbo(QOpenGLFramebufferObject *fbo); QSGDepthStencilBufferManager *depthStencilBufferManager(); @@ -124,6 +125,7 @@ protected: QMutex m_mutex; QHash<QQuickTextureFactory *, QSGTexture *> m_textures; + QSet<QSGTexture *> m_texturesToDelete; QSGAtlasTexture::Manager *m_atlasManager; QSGDepthStencilBufferManager *m_depthStencilManager; |