[PATCH] fix khotkey crashes

Andreas Pakulat apaku at gmx.de
Wed Dec 5 17:37:56 GMT 2007


On 05.12.07 18:24:27, Lubos Lunak wrote:
> On Tuesday 04 of December 2007, Andreas Pakulat wrote:
> > On 04.12.07 16:14:19, Andreas Pakulat wrote:
> > > Hi,
> > >
> > > Is this the right place for getting approval for khotkey patches? If not
> > > I'd appreciate directions.
> > >
> > > The attached patch fixes the crashes when trying to create a new action
> > > or group or trying to store those settings.
> > >
> > > May I commit this now or shall I wait until after the tagging was done
> > > (i.e. tagging freeze is lifted)
> >
> > Forget about that patch, while I tried to fixup behind kate (which
> > introduced various whitespace changes for no reason) I missed a small
> > part.
> >
> > Updated patch which actually does compile.
> >
> > Andreas
> 
> -    while( list.first())
> -        delete list.first();
> +    if( !list.isEmpty() )
> +        {
> +            while( list.first())
> +            delete list.first();
> +        }
> 
> This doesn't make sense.

It does, check your QList docs. first() doesn't work properly when the
list is empty (in debug builds it asserts).

> Either the original code was fine, or this is broken 
> as well. Just using qDeleteAll() should fix this.

Hmm, right that would be cleaner.

Andreas

-- 
Avoid reality at all costs.




More information about the kde-core-devel mailing list