QVariant debugging

David Faure faure at kde.org
Fri Dec 23 08:57:31 GMT 2005


On Friday 23 December 2005 05:32, Thomas Braxton wrote:
> I'm trying to debug why KConfigBase::readEntry(key, bool) is ambiguous, but I 
> think I may have found a bug in either g++ or Qt. I want to be sure it is not 
> something I'm doing, so could someone look at this code and see if everything 
> looks good. If it is could you compile it and see if it segfaults for you. It 
> segfaults for me when destroying the QVariant(bool), it looks like it gets 
> confused on what the type is so it tries to delete a non-existant pointer.

The test program is buggy:
readentry.cpp: In member function `QString KConfigBase::readEntry(const char*, const QString&) const':
readentry.cpp:32: warning: control reaches end of non-void function
readentry.cpp: In member function `QVariant KConfigBase::readEntry(const char*, const QVariant&) const':
readentry.cpp:43: warning: control reaches end of non-void function

After fixing those warning, e.g. adding "return QString();" from those two places,
the test program doesn't crash anymore (and is valgrind-clean).

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list