diff --git a/share/qtcreator/debugger/qttypes.py b/share/qtcreator/debugger/qttypes.py index c585829cf33441297d4877f39aef9738d9597228..8874c69aa69ad4a3d3e1607f748730914efdbb3b 100644 --- a/share/qtcreator/debugger/qttypes.py +++ b/share/qtcreator/debugger/qttypes.py @@ -1715,6 +1715,10 @@ def qdump__QTextDocument(d, value): def qdump__QUrl(d, value): if d.qtVersion() < 0x050000: + if not d.dereferenceValue(value): + # d == 0 if QUrl was constructed with default constructor + d.putValue("<invalid>") + return data = value["d"].dereference() d.putByteArrayValue(data["encodedOriginal"]) d.putPlainChildren(data) @@ -1729,7 +1733,12 @@ def qdump__QUrl(d, value): # - QString path; # - QString query; # - QString fragment; - schemeAddr = d.dereferenceValue(value) + 2 * d.intSize() + privAddress = d.dereferenceValue(value) + if not privAddress: + # d == 0 if QUrl was constructed with default constructor + d.putValue("<invalid>") + return + schemeAddr = privAddress + 2 * d.intSize() scheme = d.encodeStringHelper(d.dereference(schemeAddr)) userName = d.encodeStringHelper(d.dereference(schemeAddr + 1 * d.ptrSize())) password = d.encodeStringHelper(d.dereference(schemeAddr + 2 * d.ptrSize())) diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index f2a37614bac5c367db4423c1d68f054ebc79a972..bf4b3516be917e267407459181ab7c7d64b41dbf 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -3250,7 +3250,14 @@ void tst_Dumpers::dumper_data() % Check("s.0", "[0]", "1", "bool") // 1 -> true is done on display % Check("s.1", "[1]", "0", "bool"); - QTest::newRow("QUrl") + QTest::newRow("QUrl1") + << Data("#include <QUrl>", + "QUrl url;\n" + "unused(&url);\n") + % CoreProfile() + % Check("url", "<invalid>", "@QUrl"); + + QTest::newRow("QUrl2") << Data("#include <QUrl>", "QUrl url = QUrl::fromEncoded(\"http://foo@qt-project.org:10/have_fun\");\n" "unused(&url);\n")