Make sure OpenGL Context is valid before deleting shader
Summary: Deleting the lanczos filter deletes it's GLShader, this calls glDeleteProgram glFooBar always needs to have an openGL context, we don't know we have this on a screen changed event as it is called from outside the normal render methods. BUG: 384884 Test Plan: Ran on my wayland session. Switched geometry a lot, couldn't reproduce the crash. Ran on my desktop session, seemed the same as before Reviewers: #plasma, graesslin Reviewed By: #plasma, graesslin Subscribers: graesslin, plasma-devel, kwin, #kwin Tags: #plasma Differential Revision: https://phabricator.kde.org/D7888
This commit is contained in:
parent
8cf01bb021
commit
1783fda30e
2 changed files with 7 additions and 12 deletions
|
@ -1185,21 +1185,19 @@ void SceneOpenGL2::performPaintWindow(EffectWindowImpl* w, int mask, QRegion reg
|
|||
if (mask & PAINT_WINDOW_LANCZOS) {
|
||||
if (!m_lanczosFilter) {
|
||||
m_lanczosFilter = new LanczosFilter(this);
|
||||
// recreate the lanczos filter when the screen gets resized
|
||||
connect(screens(), SIGNAL(changed()), SLOT(resetLanczosFilter()));
|
||||
// reset the lanczos filter when the screen gets resized
|
||||
// it will get created next paint
|
||||
connect(screens(), &Screens::changed, this, [this]() {
|
||||
makeOpenGLContextCurrent();
|
||||
delete m_lanczosFilter;
|
||||
m_lanczosFilter = NULL;
|
||||
});
|
||||
}
|
||||
m_lanczosFilter->performPaint(w, mask, region, data);
|
||||
} else
|
||||
w->sceneWindow()->performPaint(mask, region, data);
|
||||
}
|
||||
|
||||
void SceneOpenGL2::resetLanczosFilter()
|
||||
{
|
||||
// TODO: Qt5 - replace by a lambda slot
|
||||
delete m_lanczosFilter;
|
||||
m_lanczosFilter = NULL;
|
||||
}
|
||||
|
||||
//****************************************
|
||||
// SceneOpenGL::Texture
|
||||
//****************************************
|
||||
|
|
|
@ -141,9 +141,6 @@ protected:
|
|||
virtual void updateProjectionMatrix() override;
|
||||
void paintCursor() override;
|
||||
|
||||
private Q_SLOTS:
|
||||
void resetLanczosFilter();
|
||||
|
||||
private:
|
||||
void performPaintWindow(EffectWindowImpl* w, int mask, QRegion region, WindowPaintData& data);
|
||||
QMatrix4x4 createProjectionMatrix() const;
|
||||
|
|
Loading…
Reference in a new issue