1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-08-27 18:02:26 -04:00

Fixed cleanup method on shader classes. Fixes #1179

This commit is contained in:
f4exb 2022-03-18 19:15:17 +01:00
parent cbdf46098d
commit 232fd689d4
6 changed files with 19 additions and 2 deletions

View File

@ -2074,6 +2074,7 @@ void GLScope::cleanup()
{ {
//makeCurrent(); //makeCurrent();
m_glShaderSimple.cleanup(); m_glShaderSimple.cleanup();
m_glShaderColors.cleanup();
m_glShaderBottom1Scale.cleanup(); m_glShaderBottom1Scale.cleanup();
m_glShaderBottom2Scale.cleanup(); m_glShaderBottom2Scale.cleanup();
m_glShaderLeft1Scale.cleanup(); m_glShaderLeft1Scale.cleanup();

View File

@ -107,6 +107,10 @@ void GLShaderColors::draw(unsigned int mode, const QMatrix4x4& transformMatrix,
void GLShaderColors::cleanup() void GLShaderColors::cleanup()
{ {
if (!QOpenGLContext::currentContext()) {
return;
}
if (m_program) if (m_program)
{ {
delete m_program; delete m_program;

View File

@ -103,10 +103,10 @@ void GLShaderSimple::draw(unsigned int mode, const QMatrix4x4& transformMatrix,
void GLShaderSimple::cleanup() void GLShaderSimple::cleanup()
{ {
if (m_program) if (QOpenGLContext::currentContext() && m_program)
{ {
delete m_program; delete m_program;
m_program = 0; m_program = nullptr;
} }
} }

View File

@ -198,6 +198,10 @@ void GLShaderTextured::drawMutable(unsigned int mode, const QMatrix4x4& transfor
void GLShaderTextured::cleanup() void GLShaderTextured::cleanup()
{ {
if (!QOpenGLContext::currentContext()) {
return;
}
if (m_program) if (m_program)
{ {
delete m_program; delete m_program;

View File

@ -272,6 +272,10 @@ void GLShaderTVArray::cleanup()
m_objCurrentRow = nullptr; m_objCurrentRow = nullptr;
if (!QOpenGLContext::currentContext()) {
return;
}
if (m_objProgram) if (m_objProgram)
{ {
delete m_objProgram; delete m_objProgram;

View File

@ -86,6 +86,10 @@ TVScreenAnalog::~TVScreenAnalog()
void TVScreenAnalog::cleanup() void TVScreenAnalog::cleanup()
{ {
if (!QOpenGLContext::currentContext()) {
return;
}
if (m_shader) if (m_shader)
{ {
delete m_shader; delete m_shader;