diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-05-18 23:09:11 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-05-19 07:48:28 -0700 |
commit | 555f2f9565c28abcbaf2fab018860b3d4cc1d434 (patch) | |
tree | 10e537daa5aa3d52b4323031062955e6860618a2 /profile-widget/animationfunctions.cpp | |
parent | ffdaba6c84431e25657de1fd3a7d67336c48aa7b (diff) | |
download | subsurface-555f2f9565c28abcbaf2fab018860b3d4cc1d434.tar.gz |
Profile: Fix leak in animation
If animDelete() was called with prefs.animation_speed == 0, the
object would not be marked for deletion, as opposed to calling
with prefs.animation_speed != 0. This would leak the objects.
Therefore delete the objects if called with prefs.animation_speed == 0.
The caller doesn't keep a reference to the objects. Therefore,
a plain delete is fine, as opposed to a deleteLater().
While touching this function, use the function-pointer version
of connect().
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'profile-widget/animationfunctions.cpp')
-rw-r--r-- | profile-widget/animationfunctions.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/profile-widget/animationfunctions.cpp b/profile-widget/animationfunctions.cpp index 33075f151..13534bf41 100644 --- a/profile-widget/animationfunctions.cpp +++ b/profile-widget/animationfunctions.cpp @@ -33,12 +33,12 @@ namespace Animations { { if (prefs.animation_speed != 0) { QPropertyAnimation *animation = new QPropertyAnimation(obj, "opacity"); - obj->connect(animation, SIGNAL(finished()), SLOT(deleteLater())); + obj->connect(animation, &QPropertyAnimation::finished, &QObject::deleteLater); animation->setStartValue(1); animation->setEndValue(0); animation->start(QAbstractAnimation::DeleteWhenStopped); } else { - obj->setProperty("opacity", 0); + delete obj; } } |