Make GL Context current when deleting lanczos textures in timer hander.
A timer could have fired at any time. We process mulitple QtQuickViews on timers which change the GL context. Deleting a kwin GLTexture calls glDeleteTextures/glDeleteFramebuffers. Surprisingly I haven't seen a crash report from this, but it doesn't look right.
This commit is contained in:
parent
0f588c256c
commit
8303a4cdf8
2 changed files with 9 additions and 2 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue