diff --git a/src/deleted.cpp b/src/deleted.cpp index 1b7de55728..d3f00d09dc 100644 --- a/src/deleted.cpp +++ b/src/deleted.cpp @@ -47,7 +47,6 @@ Deleted::~Deleted() if (workspace()) { workspace()->removeDeleted(this); } - deleteEffectWindow(); deleteItem(); } diff --git a/src/effects.cpp b/src/effects.cpp index bd7e6ddf78..c4e97916f3 100644 --- a/src/effects.cpp +++ b/src/effects.cpp @@ -1990,8 +1990,7 @@ EffectScreen::Transform EffectScreenImpl::transform() const //**************************************** EffectWindowImpl::EffectWindowImpl(Window *window) - : EffectWindow(window) - , m_window(window) + : m_window(window) , m_windowItem(nullptr) { // Deleted windows are not managed. So, when windowClosed signal is diff --git a/src/libkwineffects/kwineffects.cpp b/src/libkwineffects/kwineffects.cpp index 0c0b3c6dc6..97f7b48203 100644 --- a/src/libkwineffects/kwineffects.cpp +++ b/src/libkwineffects/kwineffects.cpp @@ -748,9 +748,8 @@ EffectWindow::Private::Private(EffectWindow *q) { } -EffectWindow::EffectWindow(QObject *parent) - : QObject(parent) - , d(new Private(this)) +EffectWindow::EffectWindow() + : d(new Private(this)) { } diff --git a/src/libkwineffects/kwineffects.h b/src/libkwineffects/kwineffects.h index 194a20cf04..0768016cd9 100644 --- a/src/libkwineffects/kwineffects.h +++ b/src/libkwineffects/kwineffects.h @@ -2366,7 +2366,7 @@ public: PAINT_DISABLED_BY_ACTIVITY = 1 << 5 }; - explicit EffectWindow(QObject *parent = nullptr); + explicit EffectWindow(); ~EffectWindow() override; Q_SCRIPTABLE virtual void addRepaint(const QRect &r) = 0; diff --git a/src/window.cpp b/src/window.cpp index 8907dc895c..1b83ad3917 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -74,7 +74,6 @@ Window::Window() , m_internalId(QUuid::createUuid()) , m_client() , is_shape(false) - , m_effectWindow(nullptr) , m_clientMachine(new ClientMachine(this)) , m_wmClientLeader(XCB_WINDOW_NONE) , m_skipCloseAnimation(false) @@ -186,7 +185,7 @@ void Window::copyToDeleted(Window *c) m_client.reset(c->m_client, false); ready_for_painting = c->ready_for_painting; is_shape = c->is_shape; - m_effectWindow = std::exchange(c->m_effectWindow, nullptr); + m_effectWindow = std::move(c->m_effectWindow); if (m_effectWindow != nullptr) { m_effectWindow->setWindow(this); } @@ -346,7 +345,7 @@ bool Window::setupCompositing() return false; } - m_effectWindow = new EffectWindowImpl(this); + m_effectWindow = std::make_unique(this); updateShadow(); m_windowItem = createItem(scene); @@ -367,7 +366,7 @@ void Window::finishCompositing(ReleaseReason releaseReason) } } m_shadow.reset(); - deleteEffectWindow(); + m_effectWindow.reset(); deleteItem(); } @@ -400,12 +399,6 @@ void Window::setReadyForPainting() } } -void Window::deleteEffectWindow() -{ - delete m_effectWindow; - m_effectWindow = nullptr; -} - void Window::deleteItem() { delete m_windowItem; diff --git a/src/window.h b/src/window.h index 0b103c01c7..bd23adc66e 100644 --- a/src/window.h +++ b/src/window.h @@ -1590,7 +1590,6 @@ protected: void getSkipCloseAnimation(); void copyToDeleted(Window *c); void disownDataPassedToDeleted(); - void deleteEffectWindow(); void setDepth(int depth); Output *m_output = nullptr; @@ -1919,7 +1918,7 @@ private: QUuid m_internalId; Xcb::Window m_client; bool is_shape; - EffectWindowImpl *m_effectWindow; + std::unique_ptr m_effectWindow; WindowItem *m_windowItem = nullptr; std::unique_ptr m_shadow; QString resource_name; @@ -2256,12 +2255,12 @@ inline const QRegion &Window::opaqueRegion() const inline EffectWindowImpl *Window::effectWindow() { - return m_effectWindow; + return m_effectWindow.get(); } inline const EffectWindowImpl *Window::effectWindow() const { - return m_effectWindow; + return m_effectWindow.get(); } inline WindowItem *Window::windowItem() const