AnimationEffect: Fix memory leak

Detected by ASAN

```
Direct leak of 144 byte(s) in 6 object(s) allocated from:
    #0 0x4dc922 in operator new(unsigned long)
(/home/kfunk/devel/install/kf5/bin/kwin_x11+0x4dc922)
    #1 0x7f43dc33d019 in KWin::AnimationEffect::AnimationEffect()
/home/kfunk/devel/src/kf5/kwin/libkwineffects/kwinanimationeffect.cpp:50:44
    #2 0x7f43dbb63e9a in KWin::ScriptedEffect::ScriptedEffect()
/home/kfunk/devel/src/kf5/kwin/scripting/scriptedeffect.cpp:422:1
    #3 0x7f43dbb60513 in KWin::ScriptedEffect::create(QString const&,
QString const&, int)
/home/kfunk/devel/src/kf5/kwin/scripting/scriptedeffect.cpp:407:30
    #4 0x7f43dbb5fcbb in KWin::ScriptedEffect::create(KPluginMetaData
const&)
/home/kfunk/devel/src/kf5/kwin/scripting/scriptedeffect.cpp:402:12
    #5 0x7f43db955fa3 in
KWin::ScriptedEffectLoader::loadEffect(KPluginMetaData const&,
QFlags<KWin::LoadEffectFlag>)
/home/kfunk/devel/src/kf5/kwin/effectloader.cpp:242:25
    #6 0x7f43db9994bf in
KWin::EffectLoadQueue<KWin::ScriptedEffectLoader,
KPluginMetaData>::dequeue()
/home/kfunk/devel/src/kf5/kwin/effectloader.h:257:9
    #7 0x7f43dbf0e2bd in
KWin::AbstractEffectLoadQueue::qt_static_metacall(QObject*,
QMetaObject::Call, int, void**)
/home/kfunk/devel/build/kf5/kwin/moc_effectloader.cpp:179:17
    #8 0x7f43d54de7b0 in QObject::event(QEvent*)
(/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x2b67b0)
    #9 0x7f43d5da39db in QApplicationPrivate::notify_helper(QObject*,
QEvent*) (/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x15b9db)
```

Differential Revision: https://phabricator.kde.org/D942
This commit is contained in:
Kevin Funk 2016-02-01 21:43:18 +01:00
parent 43bd3e44e1
commit a33c2730ba
2 changed files with 6 additions and 0 deletions

View file

@ -58,6 +58,11 @@ AnimationEffect::AnimationEffect() : d_ptr(new AnimationEffectPrivate())
QMetaObject::invokeMethod( this, "init", Qt::QueuedConnection ); QMetaObject::invokeMethod( this, "init", Qt::QueuedConnection );
} }
AnimationEffect::~AnimationEffect()
{
delete d_ptr;
}
void AnimationEffect::init() void AnimationEffect::init()
{ {
Q_D(AnimationEffect); Q_D(AnimationEffect);

View file

@ -114,6 +114,7 @@ public:
* If you shadow _windowClosed() or connect your slot to EffectsHandler::windowClosed() after _windowClosed() was connected, animations for closing windows will fail. * If you shadow _windowClosed() or connect your slot to EffectsHandler::windowClosed() after _windowClosed() was connected, animations for closing windows will fail.
*/ */
AnimationEffect(); AnimationEffect();
~AnimationEffect();
bool isActive() const; bool isActive() const;
/** /**