diff --git a/plugins/scenes/opengl/lanczosfilter.cpp b/plugins/scenes/opengl/lanczosfilter.cpp index a2a8c3f016..4582550dc4 100644 --- a/plugins/scenes/opengl/lanczosfilter.cpp +++ b/plugins/scenes/opengl/lanczosfilter.cpp @@ -32,7 +32,7 @@ namespace KWin { -LanczosFilter::LanczosFilter(QObject* parent) +LanczosFilter::LanczosFilter(Scene *parent) : QObject(parent) , m_offscreenTex(nullptr) , m_offscreenTarget(nullptr) @@ -40,6 +40,7 @@ LanczosFilter::LanczosFilter(QObject* parent) , m_shader(nullptr) , m_uOffsets(0) , m_uKernel(0) + , m_scene(parent) { } @@ -379,6 +380,8 @@ void LanczosFilter::timerEvent(QTimerEvent *event) if (event->timerId() == m_timer.timerId()) { m_timer.stop(); + m_scene->makeOpenGLContextCurrent(); + delete m_offscreenTarget; delete m_offscreenTex; m_offscreenTarget = nullptr; @@ -387,6 +390,8 @@ void LanczosFilter::timerEvent(QTimerEvent *event) workspace()->forEachToplevel([this](Toplevel *toplevel) { discardCacheTexture(toplevel->effectWindow()); }); + + m_scene->doneOpenGLContextCurrent(); } } diff --git a/plugins/scenes/opengl/lanczosfilter.h b/plugins/scenes/opengl/lanczosfilter.h index f847f13a55..56033c1b5c 100644 --- a/plugins/scenes/opengl/lanczosfilter.h +++ b/plugins/scenes/opengl/lanczosfilter.h @@ -26,13 +26,14 @@ class WindowPaintData; class GLTexture; class GLRenderTarget; class GLShader; +class Scene; class LanczosFilter : public QObject { Q_OBJECT public: - explicit LanczosFilter(QObject* parent = nullptr); + explicit LanczosFilter(Scene *parent); ~LanczosFilter() override; void performPaint(EffectWindowImpl* w, int mask, QRegion region, WindowPaintData& data); @@ -55,6 +56,7 @@ private: int m_uKernel; QVector2D m_offsets[16]; QVector4D m_kernel[16]; + Scene *m_scene; }; } // namespace