Review Request: Fix segmentation fault at plasma_applet_animation_example

loureiro.andrew at gmail.com loureiro.andrew at gmail.com
Thu Jan 28 13:52:07 CET 2010



> On 2010-01-27 17:08:08, Aaron Seigo wrote:
> > this will result in a leak when the layout isn't assigned. e.g.:
> > 
> >     Animation* rotStackedAnim = Plasma::Animator::create(Plasma::Animator::RotationStackedAnimation);
> >     delete rotStackedAnim;
> > 
> > and then we have a leak.
> > 
> > what the dtor probably should be is:
> > 
> > if (!m_sLayout->parentLayoutItem()) {
> >      delete m_sLayout;
> > }
> > 
> > m_sLayout should also be a QWeakPointer since it could be deleted behind our backs.

Ok,but the StackedLayout class doesn't inherits from QObject so use QWeakPointer is not allowed then I think that StackedLayout class should be supports multiple inheritance, in other words, inherits from QGraphicsLayout and QObject.


- loureiro


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/2738/#review3913
-----------------------------------------------------------


On 2010-01-27 14:35:00, loureiro wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/2738/
> -----------------------------------------------------------
> 
> (Updated 2010-01-27 14:35:00)
> 
> 
> Review request for Plasma, Aaron Seigo, Marco Martin, igorto, and Adenilson Cavalcanti.
> 
> 
> Summary
> -------
> 
> This is a small patch that fix a segmentation fault at plasma_applet_animation_example when we close the window.
> Basically I remove the delete sentence at the RotationStackedAnimation's destruct, I made it because I think when we create a QGraphicsLinearLayout passing a widget that widget will be the owner and responsible to delete it as well its children elements and running the example under valgrind I don't get leaks.
> 
> 
> Diffs
> -----
> 
>   trunk/KDE/kdelibs/plasma/animations/rotationstacked.cpp 1080090 
>   trunk/KDE/kdelibs/plasma/animations/stackedlayout.h 1080090 
> 
> Diff: http://reviewboard.kde.org/r/2738/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> loureiro
> 
>



More information about the Plasma-devel mailing list