diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-06-19 13:11:03 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-07-13 22:27:14 +0000 |
commit | a082b41d2cdb72099cd5f6b7636b34836880d150 (patch) | |
tree | 40a200dd805ea8739ce64735ff02138efa3045cf /src/gui | |
parent | f5243c0591469dd876acef2fbcbe1837d5bf648a (diff) |
QTextEngine: don't hold ItemDecoration in QList
ItemDecoration is larger than a void*, so holding it in QLists
is needlessly inefficient. Worse, the code could come to depend
on the fragile property of (inefficient) QLists that references
to elements therein never are invalidated.
Fix by marking the type movable and holding in QVector instead.
Change-Id: I06d7a77529f7cff2ba503c5e8d6e5df0ad801a21
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/text/qtextengine_p.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index 3590c6da07..d2b39f274c 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -400,6 +400,7 @@ public: }; struct ItemDecoration { + ItemDecoration() {} // for QVector, don't use ItemDecoration(qreal x1, qreal x2, qreal y, const QPen &pen): x1(x1), x2(x2), y(y), pen(pen) {} @@ -409,7 +410,7 @@ public: QPen pen; }; - typedef QList<ItemDecoration> ItemDecorationList; + typedef QVector<ItemDecoration> ItemDecorationList; QTextEngine(); QTextEngine(const QString &str, const QFont &f); @@ -643,6 +644,7 @@ public: LayoutData _layoutData; void *_memory[MemSize]; }; +Q_DECLARE_TYPEINFO(QTextEngine::ItemDecoration, Q_MOVABLE_TYPE); struct QTextLineItemIterator { |