diff options
Diffstat (limited to 'src/render/materialsystem/shader.cpp')
-rw-r--r-- | src/render/materialsystem/shader.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/render/materialsystem/shader.cpp b/src/render/materialsystem/shader.cpp index d390d74d4..bd0af0bed 100644 --- a/src/render/materialsystem/shader.cpp +++ b/src/render/materialsystem/shader.cpp @@ -71,6 +71,8 @@ Shader::~Shader() { // TO DO: ShaderProgram is leaked as of now // Fix that taking care that they may be shared given a same dna + + QObject::disconnect(m_contextConnection); } void Shader::cleanup() @@ -118,6 +120,11 @@ void Shader::setGraphicsContext(GraphicsContext *context) { QMutexLocker lock(&m_mutex); m_graphicsContext = context; + if (m_graphicsContext) { + m_contextConnection = QObject::connect(m_graphicsContext->openGLContext(), + &QOpenGLContext::aboutToBeDestroyed, + [this] { setGraphicsContext(nullptr); }); + } } GraphicsContext *Shader::graphicsContext() |