diff options
author | Milian Wolff <milian.wolff@kdab.com> | 2024-01-04 12:19:08 +0100 |
---|---|---|
committer | Milian Wolff <milian.wolff@kdab.com> | 2024-01-10 16:14:27 +0000 |
commit | 76845e1d31a61735a0f0261fbc15ed7ea5ff71dc (patch) | |
tree | e4c30d381d1d47187b4e1ddea71bfe791f11fc92 /src/widgets/widgets | |
parent | f23154c05ba0de300d017f1c50910da324414eef (diff) |
Fix potential leak of QPropertyAnimation in QLineEditIconButton
When startOpacityAnimation is triggered and the animation doesn't
finish, it might get leaked during shutdown as shown by valgrind:
```
==133963== 600 (16 direct, 584 indirect) bytes in 1 blocks are definitely lost in loss record 2,326 of 2,356
==133963== at 0x4841FA3: operator new(unsigned long) (vg_replace_malloc.c:483)
==133963== by 0x12698E2D: QLineEditIconButton::startOpacityAnimation(double) (qlineedit_p.cpp:437)
==133963== by 0x1269900D: displayWidgets(std::vector<QLineEditPrivate::SideWidgetEntry, std::allocator<QLineEditPrivate::SideWidgetEntry> > const&, bool) (qlineedit_p.cpp:459)
==133963== by 0x126A1084: QLineEdit::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (moc_qlineedit.cpp:276)
==133963== by 0x152D781E: void doActivate<false>(QObject*, int, void**) (qobject.cpp:3935)
==133963== by 0x1269AB01: QLineEdit::textChanged(QString const&) (moc_qlineedit.cpp:447)
==133963== by 0x126A0EF8: QLineEdit::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (moc_qlineedit.cpp:255)
==133963== by 0x152D781E: void doActivate<false>(QObject*, int, void**) (qobject.cpp:3935)
==133963== by 0x126A1A94: QWidgetLineControl::textChanged(QString const&) (moc_qwidgetlinecontrol_p.cpp:273)
==133963== by 0x126A4C35: QWidgetLineControl::finishChange(int, bool, bool) (qwidgetlinecontrol.cpp:736)
==133963== by 0x126A4F05: QWidgetLineControl::internalSetText(QString const&, int, bool) (qwidgetlinecontrol.cpp:772)
==133963== by 0x12698AF4: setText (qwidgetlinecontrol_p.h:251)
==133963== by 0x12698AF4: QLineEditPrivate::setText(QString const&) (qlineedit_p.cpp:277)
```
Note that the line numbers above are potentially slightly off as that
backtrace was recorded on Qt 5.15.9.
Pick-to: 6.7 6.6 6.5 6.2 5.15
Change-Id: Ie79744d98d2783e4644e18ec51892c0bc43c1557
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Diffstat (limited to 'src/widgets/widgets')
-rw-r--r-- | src/widgets/widgets/qlineedit_p.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index 3c49332429..fdd6a3aa4f 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -432,7 +432,7 @@ void QLineEditIconButton::animateShow(bool visible) void QLineEditIconButton::startOpacityAnimation(qreal endValue) { - QPropertyAnimation *animation = new QPropertyAnimation(this, QByteArrayLiteral("opacity")); + QPropertyAnimation *animation = new QPropertyAnimation(this, QByteArrayLiteral("opacity"), this); connect(animation, &QPropertyAnimation::finished, this, &QLineEditIconButton::onAnimationFinished); animation->setDuration(160); |