From 555f2f9565c28abcbaf2fab018860b3d4cc1d434 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Fri, 18 May 2018 23:09:11 +0200 Subject: [PATCH] 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 --- profile-widget/animationfunctions.cpp | 4 ++-- 1 file 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; } }