Commit 1af0ee3f authored by David Edmundson's avatar David Edmundson
Browse files

[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
parent cd99a901
......@@ -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();
}
......
......@@ -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;
};
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment