From 5cfb252b07468dbfdd3ee9a4230164d431c1715d Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 11 Sep 2013 12:42:43 +0200 Subject: qdoc: Avoid CppCodeMarker crash on abstract QML types In a while loop, when the first QML type encountered was abstract, qdoc didn't create a class map on the heap, but later in the loop, the class map was used anyway. This caused a crash because of a null pointer to the class map. Now qdoc creates a class map if one hasn't been created yet, even if the QML type is abstract. This might not be correct, but the real problem is probably the order in which qdoc processes the QML types. It should probably always start with a non-abstract type. But this fix will at least avoid the crash. Task-number: QTBUG-33387 Change-Id: Icecb165261469856820f81e3866218b15416ae3b Reviewed-by: Jerome Pasion --- src/tools/qdoc/cppcodemarker.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/tools/qdoc/cppcodemarker.cpp') diff --git a/src/tools/qdoc/cppcodemarker.cpp b/src/tools/qdoc/cppcodemarker.cpp index ad3c5cba47..ab58238301 100644 --- a/src/tools/qdoc/cppcodemarker.cpp +++ b/src/tools/qdoc/cppcodemarker.cpp @@ -1229,8 +1229,14 @@ QList
CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, Syno If the QML type is abstract, do not create a new entry in the list for it. Instead, add its members to the current entry. + + However, if the first class is abstract, + there is no current entry. In that case, + create a new entry in the list anyway. + I'm not sure that is correct, but it at + least can prevent a crash. */ - if (!current->isAbstract()) { + if (!current->isAbstract() || !classMap) { classMap = new ClassMap; classMap->first = current; all.classMapList_.append(classMap); -- cgit v1.2.3