[plasma-framework] src/plasma: plasma: Fix applet actions might be nullptr

Christoph Feck cfeck at kde.org
Wed Aug 26 09:38:50 UTC 2015


On Wednesday 26 August 2015 11:27:05 Leslie Zhai wrote:
> Git commit 4e9b32d80d6b43ad3d1ddd47c948ad066608b052 by Leslie 
Zhai.
> Committed on 26/08/2015 at 09:24.
> Pushed by lesliezhai into branch 'master'.
> 
> plasma: Fix applet actions might be nullptr
> BUG:351777
> 
> M  +1    -1    src/plasma/applet.cpp
> 
> http://commits.kde.org/plasma-framework/4e9b32d80d6b43ad3d1ddd47c94
> 8ad066608b052
> 
> diff --git a/src/plasma/applet.cpp b/src/plasma/applet.cpp
> index 895555c..3716a83 100644
> --- a/src/plasma/applet.cpp
> +++ b/src/plasma/applet.cpp
> @@ -568,7 +568,7 @@ QList<QAction *> Applet::contextualActions()
> 
>  KActionCollection *Applet::actions() const
>  {
> -    return d->actions;
> +    return d->actions ? d->actions : new
> KActionCollection((QObject *)this); }
> 
>  Types::FormFactor Applet::formFactor() const

Doesn't this leak memory? I doubt the caller of Applet::actions() is 
supposed to delete the received pointer.


More information about the Plasma-devel mailing list