drm: Don't call virtual methods from a parent class destructor

We'd be relying on AbstractEglDrmBackend on calling cleanup but we'd be
doing it when cleanupSurfaces cannot be reached out anymore, turning it
into a half-baked cleanup.

Instead call cleanup from the leaf class destructors.
This commit is contained in:
Aleix Pol 2021-04-19 16:23:46 +02:00
parent 4c74a24059
commit b82840d7e0
6 changed files with 12 additions and 7 deletions

View file

@ -24,11 +24,6 @@ AbstractEglDrmBackend::AbstractEglDrmBackend(DrmBackend *drmBackend, DrmGpu *gpu
connect(m_gpu, &DrmGpu::outputDisabled, this, &AbstractEglDrmBackend::removeOutput);
}
AbstractEglDrmBackend::~AbstractEglDrmBackend()
{
cleanup();
}
void AbstractEglDrmBackend::screenGeometryChanged(const QSize &size)
{
Q_UNUSED(size)

View file

@ -22,8 +22,6 @@ class DrmOutput;
class AbstractEglDrmBackend : public AbstractEglBackend
{
public:
~AbstractEglDrmBackend();
void screenGeometryChanged(const QSize &size) override;
virtual int screenCount() const = 0;

View file

@ -41,6 +41,11 @@ EglGbmBackend::EglGbmBackend(DrmBackend *drmBackend, DrmGpu *gpu)
{
}
EglGbmBackend::~EglGbmBackend()
{
cleanup();
}
void EglGbmBackend::cleanupSurfaces()
{
for (auto it = m_outputs.begin(); it != m_outputs.end(); ++it) {

View file

@ -38,6 +38,7 @@ class EglGbmBackend : public AbstractEglDrmBackend
Q_OBJECT
public:
EglGbmBackend(DrmBackend *drmBackend, DrmGpu *gpu);
~EglGbmBackend() override;
SceneOpenGLTexturePrivate *createBackendTexture(SceneOpenGLTexture *texture) override;
QRegion beginFrame(int screenId) override;

View file

@ -75,6 +75,11 @@ EglStreamBackend::EglStreamBackend(DrmBackend *drmBackend, DrmGpu *gpu)
{
}
EglStreamBackend::~EglStreamBackend()
{
cleanup();
}
void EglStreamBackend::cleanupSurfaces()
{
for (auto it = m_outputs.constBegin(); it != m_outputs.constEnd(); ++it) {

View file

@ -27,6 +27,7 @@ class EglStreamBackend : public AbstractEglDrmBackend
Q_OBJECT
public:
EglStreamBackend(DrmBackend *b, DrmGpu *gpu);
~EglStreamBackend() override;
SceneOpenGLTexturePrivate *createBackendTexture(SceneOpenGLTexture *texture) override;
QRegion beginFrame(int screenId) override;
void endFrame(int screenId, const QRegion &damage, const QRegion &damagedRegion) override;