From 1af0ee3f71eaec9d9ac937a059e447f4f7c9d0bc Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Mon, 21 Oct 2019 16:45:00 +0100 Subject: [PATCH] [effects/presentwindows] Fix newly introduced memory leak Summary: Introduced by accident in my port. Reviewers: #kwin Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D24835 --- effects/presentwindows/presentwindows.cpp | 8 +++----- effects/presentwindows/presentwindows.h | 5 +++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/effects/presentwindows/presentwindows.cpp b/effects/presentwindows/presentwindows.cpp index 1fc31dedf5..87a31db17b 100644 --- a/effects/presentwindows/presentwindows.cpp +++ b/effects/presentwindows/presentwindows.cpp @@ -38,7 +38,6 @@ along with this program. If not, see . #include #include #include -#include #include #include @@ -1936,27 +1935,26 @@ void PresentWindowsEffect::reCreateGrids() CloseWindowView::CloseWindowView(QObject *parent) : EffectQuickScene(parent) - , m_armTimer(new QElapsedTimer()) { setSource(QUrl(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("kwin/effects/presentwindows/main.qml")))); if (QQuickItem *item = rootItem()) { connect(item, SIGNAL(clicked()), this, SLOT(clicked())); setGeometry(QRect(QPoint(), QSize(item->implicitWidth(), item->implicitHeight()))); } - m_armTimer->restart(); + m_armTimer.restart(); } void CloseWindowView::clicked() { // 50ms until the window is elevated (seen!) and 300ms more to be "realized" by the user. - if (m_armTimer->hasExpired(350)) { + if (m_armTimer.hasExpired(350)) { emit requestClose(); } } void CloseWindowView::disarm() { - m_armTimer->restart(); + m_armTimer.restart(); } diff --git a/effects/presentwindows/presentwindows.h b/effects/presentwindows/presentwindows.h index b260ec61e1..523b46a3ef 100644 --- a/effects/presentwindows/presentwindows.h +++ b/effects/presentwindows/presentwindows.h @@ -27,8 +27,9 @@ along with this program. If not, see . #include #include +#include + class QMouseEvent; -class QElapsedTimer; class QQuickView; namespace KWin @@ -44,7 +45,7 @@ Q_SIGNALS: private Q_SLOTS: void clicked(); private: - QElapsedTimer *m_armTimer; + QElapsedTimer m_armTimer; }; /**