[Development] [Interest] Valgrind messages Qt 4.8.2

Olivier Goffart olivier at woboq.com
Tue Jul 31 10:07:25 CEST 2012


On Tuesday 31 July 2012 09:49:44 Linos wrote:
> Hi,
> 	i am using valgrind integration in Qt Creator, works fine for me, after
> check an old small project of mine that have been some time untouched it
> remains having 0 errors but now if i use valgrind from the command line
> like i did when i fixed memory errors in this project (using the same
> suppression file) i get what seems to be Qt internal errors that i didn't
> find in Qt 4.6.x versions.
[...]
> don't know why because everytime fill() gets called this gets called before:
> 
> void CameraLayout::clear(){
>     for (int r = 0; r < rowCount(); ++r ){
>         for (int c = 0; c < columnCount(); ++c ){
>                 QLayoutItem *item = itemAtPosition( r, c );
>                 if ( item ){
>                         removeItem( item );


The documentation of QLayout::removeItem states:
"It is the caller's responsibility to delete the item."

In other words, you must delete 'item' and you do not seem to.


>                         if ( item->widget() ){
>                             BlackWidget *bw = qobject_cast < BlackWidget *>
> ( item->widget() );
>                             if ( bw ) delete bw;
>                             //else is camera o similar
>                             else item->widget()->setVisible( false );
>                         }
>                 }
>             }
>         }


-- 
Olivier

Woboq - Qt services and support - http://woboq.com




More information about the Development mailing list