summaryrefslogtreecommitdiffstats
path: root/examples/widgets
diff options
context:
space:
mode:
authorJan Arve Sæther <jan-arve.saether@qt.io>2022-09-08 12:56:24 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-09-15 16:28:04 +0000
commit577d9b415a5f512c6f44ca46d5f750925ed05365 (patch)
treecffc92cce13af8631915a3a229754336fe88a8ca /examples/widgets
parent3fcebc482de6cfbecbce992176dddda8f523c966 (diff)
Pass a parent pointer to the Animation instance to avoid memory leak
The leak is just on termination, but we should show good practices in our examples Change-Id: I39abb7545d3c68a1a537b865ba3fcb5e60c22fbf Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> (cherry picked from commit 30947c7fd4dddd76b69a3aa11567e27174d7a3ea) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples/widgets')
-rw-r--r--examples/widgets/animation/easing/animation.h4
-rw-r--r--examples/widgets/animation/easing/window.cpp2
2 files changed, 3 insertions, 3 deletions
diff --git a/examples/widgets/animation/easing/animation.h b/examples/widgets/animation/easing/animation.h
index 696257bb4a..d78997d5ff 100644
--- a/examples/widgets/animation/easing/animation.h
+++ b/examples/widgets/animation/easing/animation.h
@@ -62,8 +62,8 @@ public:
CirclePath,
NPathTypes
};
- Animation(QObject *target, const QByteArray &prop)
- : QPropertyAnimation(target, prop)
+ Animation(QObject *target, const QByteArray &prop, QObject *parent = nullptr)
+ : QPropertyAnimation(target, prop, parent)
{
setPathType(LinearPath);
}
diff --git a/examples/widgets/animation/easing/window.cpp b/examples/widgets/animation/easing/window.cpp
index 7b4fe1d912..d0deb843e4 100644
--- a/examples/widgets/animation/easing/window.cpp
+++ b/examples/widgets/animation/easing/window.cpp
@@ -82,7 +82,7 @@ Window::Window(QWidget *parent)
m_scene.addItem(m_item);
m_ui.graphicsView->setScene(&m_scene);
- m_anim = new Animation(m_item, "pos");
+ m_anim = new Animation(m_item, "pos", this);
m_anim->setEasingCurve(QEasingCurve::OutBounce);
m_ui.easingCurvePicker->setCurrentRow(int(QEasingCurve::OutBounce));