Commit e2d5ec60 authored by Roman Gilg's avatar Roman Gilg

Destroy dmabuf implementation on EGL backend going down

Summary:
We leak memory if we do not destroy the dmabuf implementation on EGL backend
going down.

Also this makes sure everything is cleaned up on shutdown.

FIXED-IN: 5.17.4

BUG: 413637

Test Plan: Compiles, settings change and shutdown ok.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25577
parent fd69924e
......@@ -60,7 +60,7 @@ public:
using Flags = KWayland::Server::LinuxDmabufUnstableV1Interface::Flags;
explicit LinuxDmabuf();
~LinuxDmabuf();
~LinuxDmabuf() override;
KWayland::Server::LinuxDmabufUnstableV1Buffer *importBuffer(const QVector<Plane> &planes,
uint32_t format,
......
......@@ -66,7 +66,10 @@ AbstractEglBackend::AbstractEglBackend()
connect(Compositor::self(), &Compositor::aboutToDestroy, this, &AbstractEglBackend::unbindWaylandDisplay);
}
AbstractEglBackend::~AbstractEglBackend() = default;
AbstractEglBackend::~AbstractEglBackend()
{
delete m_dmaBuf;
}
void AbstractEglBackend::unbindWaylandDisplay()
{
......@@ -171,7 +174,8 @@ void AbstractEglBackend::initWayland()
}
}
EglDmabuf::factory(this);
Q_ASSERT(!m_dmaBuf);
m_dmaBuf = EglDmabuf::factory(this);
}
void AbstractEglBackend::initClientExtensions()
......
......@@ -39,6 +39,8 @@ class BufferInterface;
namespace KWin
{
class EglDmabuf;
class KWIN_EXPORT AbstractEglBackend : public QObject, public OpenGLBackend
{
Q_OBJECT
......@@ -85,6 +87,7 @@ private:
EGLContext m_context = EGL_NO_CONTEXT;
EGLConfig m_config = nullptr;
QList<QByteArray> m_clientExtensions;
EglDmabuf *m_dmaBuf = nullptr;
};
class KWIN_EXPORT AbstractEglTexture : public SceneOpenGLTexturePrivate
......
......@@ -77,7 +77,7 @@ public:
static EglDmabuf* factory(AbstractEglBackend *backend);
explicit EglDmabuf(AbstractEglBackend *backend);
~EglDmabuf();
~EglDmabuf() override;
KWayland::Server::LinuxDmabufUnstableV1Buffer *importBuffer(const QVector<Plane> &planes,
uint32_t format,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment