From f8c00a530fc4bddf3e8dc19834b83544002c9997 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 29 Apr 2021 09:02:49 +0300 Subject: [PATCH] Remove Platform::prepareShutdown() Platform::prepareShutdown() was introduced to work around the issue where the platform accesses destroyed OutputDeviceInterface objects. Since we no longer query OutputDeviceInterface for output info, the Platform::prepareShutdown() function can be dropped. --- src/main_wayland.cpp | 3 --- src/platform.cpp | 5 ----- src/platform.h | 7 ------- src/plugins/platforms/drm/drm_backend.cpp | 10 +--------- src/plugins/platforms/drm/drm_backend.h | 1 - 5 files changed, 1 insertion(+), 25 deletions(-) diff --git a/src/main_wayland.cpp b/src/main_wayland.cpp index 734c39c58b..810606a91e 100644 --- a/src/main_wayland.cpp +++ b/src/main_wayland.cpp @@ -129,9 +129,6 @@ ApplicationWayland::~ApplicationWayland() return; } - if (auto *platform = kwinApp()->platform()) { - platform->prepareShutdown(); - } // need to unload all effects prior to destroying X connection as they might do X calls if (effects) { static_cast(effects)->unloadAllEffects(); diff --git a/src/platform.cpp b/src/platform.cpp index 7e2509da23..264cd213a5 100644 --- a/src/platform.cpp +++ b/src/platform.cpp @@ -91,11 +91,6 @@ XRenderBackend *Platform::createXRenderBackend() } #endif -void Platform::prepareShutdown() -{ - setOutputsEnabled(false); -} - Edge *Platform::createScreenEdge(ScreenEdges *edges) { return new Edge(edges); diff --git a/src/platform.h b/src/platform.h index 569148b0f6..ef43cb115f 100644 --- a/src/platform.h +++ b/src/platform.h @@ -80,13 +80,6 @@ public: return nullptr; } - /** - * Informs the Platform that it is about to go down and shall do appropriate cleanup. - * Child classes can override this function but must call the parent implementation in - * the end. - */ - virtual void prepareShutdown(); - /** * Allows the platform to create a platform specific screen edge. * The default implementation creates a Edge. diff --git a/src/plugins/platforms/drm/drm_backend.cpp b/src/plugins/platforms/drm/drm_backend.cpp index c708b82f98..5795414017 100644 --- a/src/plugins/platforms/drm/drm_backend.cpp +++ b/src/plugins/platforms/drm/drm_backend.cpp @@ -65,6 +65,7 @@ DrmBackend::DrmBackend(QObject *parent) DrmBackend::~DrmBackend() { + writeOutputsConfiguration(); qDeleteAll(m_gpus); } @@ -73,15 +74,6 @@ Session *DrmBackend::session() const return m_session; } -void DrmBackend::prepareShutdown() -{ - writeOutputsConfiguration(); - for (DrmOutput *output : m_outputs) { - output->teardown(); - } - Platform::prepareShutdown(); -} - Outputs DrmBackend::outputs() const { return m_outputs; diff --git a/src/plugins/platforms/drm/drm_backend.h b/src/plugins/platforms/drm/drm_backend.h index 6452cdda55..83f97407f2 100644 --- a/src/plugins/platforms/drm/drm_backend.h +++ b/src/plugins/platforms/drm/drm_backend.h @@ -43,7 +43,6 @@ public: DmaBufTexture *createDmaBufTexture(const QSize &size) override; Session *session() const override; bool initialize() override; - void prepareShutdown() override; Outputs outputs() const override; Outputs enabledOutputs() const override;