summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@digia.com>2013-09-11 12:42:43 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-12 07:10:59 +0200
commit5cfb252b07468dbfdd3ee9a4230164d431c1715d (patch)
treecdcb0e82c872407edfd0accb5b73ab99ff185d8a /src/tools
parentffa4de4bec01335eb63016f0e89b568fb7416ea8 (diff)
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 <jerome.pasion@digia.com>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/qdoc/cppcodemarker.cpp8
1 files changed, 7 insertions, 1 deletions
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<Section> 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);