summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtexthtmlparser_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-09-23 19:32:35 +0200
committerLars Knoll <lars.knoll@qt.io>2020-10-05 09:57:08 +0200
commit1b06c07115d7da4fb2af05d30647d822c3ccae7a (patch)
tree401b2f284c9d3f79fb7036aee9c77b4d4182a80a /src/gui/text/qtexthtmlparser_p.h
parent0ad96eac3895e999aa71a68beaff25f5f2d612e6 (diff)
Don't store QTextHtmlParserNode by value in a QList
This is a performance bottleneck as the parse nodes are huge and we don't want to reallocate them all the time. Fixes: QTBUG-86354 Change-Id: Ia437acbb5b2c8af1723932d2cd96ba2ae48a871b Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/gui/text/qtexthtmlparser_p.h')
-rw-r--r--src/gui/text/qtexthtmlparser_p.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gui/text/qtexthtmlparser_p.h b/src/gui/text/qtexthtmlparser_p.h
index 4bfdab124b..2650c9cc3e 100644
--- a/src/gui/text/qtexthtmlparser_p.h
+++ b/src/gui/text/qtexthtmlparser_p.h
@@ -281,9 +281,13 @@ public:
MarginBottom,
MarginLeft
};
+ ~QTextHtmlParser()
+ {
+ qDeleteAll(nodes);
+ }
- inline const QTextHtmlParserNode &at(int i) const { return nodes.at(i); }
- inline QTextHtmlParserNode &operator[](int i) { return nodes[i]; }
+ inline const QTextHtmlParserNode &at(int i) const { return *nodes.at(i); }
+ inline QTextHtmlParserNode &operator[](int i) { return *nodes[i]; }
inline int count() const { return nodes.count(); }
inline int last() const { return nodes.count()-1; }
int depth(int i) const;
@@ -308,7 +312,7 @@ public:
static int lookupElement(const QString &element);
protected:
QTextHtmlParserNode *newNode(int parent);
- QList<QTextHtmlParserNode> nodes;
+ QList<QTextHtmlParserNode *> nodes;
QString txt;
int pos, len;