[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
This commit is contained in:
David Edmundson 2019-10-21 16:45:00 +01:00
parent cd99a901f6
commit 1af0ee3f71
2 changed files with 6 additions and 7 deletions

View file

@ -38,7 +38,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QQuickView>
#include <QGraphicsObject>
#include <QTimer>
#include <QElapsedTimer>
#include <QVector2D>
#include <QVector4D>
@ -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();
}

View file

@ -27,8 +27,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kwineffects.h>
#include <kwineffectquickview.h>
#include <QElapsedTimer>
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;
};
/**