diff options
author | Topi Reinio <topi.reinio@qt.io> | 2020-02-17 13:45:09 +0100 |
---|---|---|
committer | Topi Reinio <topi.reinio@qt.io> | 2020-02-17 16:55:27 +0100 |
commit | 4776efd26bf95d21b7cc3137ecc2d81a6ccd2b80 (patch) | |
tree | 81ed99ebe90b7f183baddfae5dba70cd29b4f976 | |
parent | ae59b065061e6e0e8ccf2434270a36978e655849 (diff) |
qdoc: Fix assert in DocBookGenerator
DocBookGenerator::generateExampleFilePage() constructs a new writer
instance while another one is still in use. Store the old one, and
restore it once the example page has been generated.
Fixes: QTBUG-82251
Change-Id: Ic41c8fed82c27723198415a32bca0225b36922b3
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
-rw-r--r-- | src/qdoc/docbookgenerator.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/qdoc/docbookgenerator.cpp b/src/qdoc/docbookgenerator.cpp index 39604ce15..8e2292211 100644 --- a/src/qdoc/docbookgenerator.cpp +++ b/src/qdoc/docbookgenerator.cpp @@ -2246,12 +2246,14 @@ void DocBookGenerator::generateExampleFilePage(const Node *node, const QString & CodeMarker *marker) { Q_UNUSED(marker); - Q_ASSERT(writer == nullptr); // From HtmlGenerator::generateExampleFilePage. if (!node->isExample()) return; const auto en = static_cast<const ExampleNode *>(node); + + // Store current (active) writer + QXmlStreamWriter *currentWriter = writer; writer = startDocument(en, file); generateHeader(en->fullTitle(), en->subtitle(), en); @@ -2265,6 +2267,8 @@ void DocBookGenerator::generateExampleFilePage(const Node *node, const QString & generateText(text, en); endDocument(); + // Restore writer + writer = currentWriter; } void DocBookGenerator::generateReimplementsClause(const FunctionNode *fn) |