Qt World Summit: Register Today!

Valgrind hits in QString?

  • All,
    I may be asking a dumb question here - possibly I've not initialized something correctly:

    I see valgrind hits in QString::fromLatin1_helper(), where it looks like the declaration on line 102 of qstring.cpp is not correctly initialized.

    Line 102 states:
    QTextCodec *QString::codecForCStrings;

    Should this not be set to zero by default?


  • Do you also get this hit if you run valgrind through Qt Creator's analyzer? That is valgrind as well, but it uses ignore lists for Qt where valgrind is known to give false positives...

  • I can't see how that would help in this case; although I'll try your suggestion this evening.

    However, I fail to see where the QTextCodec is initialized; it must be operating by luck - i.e. initialized as zero by the loader.

    The more I look at it, line 102 looks to me like an initializer that someone forgot to finish. I.e. it adds nothing, since codecForCStrings is declared in the QString header. qstring.h is included from qstringlist.h, and therefore, this line does nothing.


  • If you feel you have found a bug in Qt, I would suggest you "report":http://bugreports.qt.nokia.com it, or better yet, prepare a patch and "submit":http://qt-project.org/ it. I'm sure fixes would be welcomed!

    I would also suggest you pop into IRC into the #qt-labs channel on freenode. This is the public hideout of Qt developers, and you'll find people there much more knowledgeable on the inner workings of Qt than I am.

  • Great - that is a huge help. (Where to report bugs was my next question). I'll take it there.


Log in to reply