mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
ffdaba6c84
commit
555f2f9565
1 changed files with 2 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue