Stabilized the QString debug dumper a bit on Windows.

Try to prevent dumper crashes on
unitialized variables that slow down the debugger.
Acked-by: hjk <qtc-committer@nokia.com>
This commit is contained in:
Friedemann Kleint
2009-05-20 16:59:40 +02:00
parent 65a179da14
commit 3ba72d0e1e

View File

@@ -1995,10 +1995,15 @@ static void qDumpQString(QDumper &d)
{ {
const QString &str = *reinterpret_cast<const QString *>(d.data); const QString &str = *reinterpret_cast<const QString *>(d.data);
if (!str.isEmpty()) { const int size = str.size();
qCheckAccess(str.unicode()); if (size < 0)
if (!str.unicode()[str.size()].isNull()) // must be '\0' terminated return;
qCheckAccess(0); if (size) {
const QChar *unicode = str.unicode();
qCheckAccess(unicode);
qCheckAccess(unicode + size);
if (!unicode[size].isNull()) // must be '\0' terminated
return;
} }
P(d, "value", str); P(d, "value", str);