summaryrefslogtreecommitdiffstats
path: root/src/widgets/graphicsview
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-07-09 21:40:58 +0200
committerMarc Mutz <marc.mutz@kdab.com>2015-07-13 10:37:31 +0000
commit14235ada48d5f3015571102549d56c8cfbcdcccb (patch)
treefc67a19169543459a93c42f4b937cca26ca4f573 /src/widgets/graphicsview
parent827d1ed633b13719964d82e06195d9df4bd34419 (diff)
QGraphicsItem: don't hold ExtraStruct in a QList
ExtraStruct is larger than a void*, so holding it in QList 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 it movable, and holding in a QVector instead. Change-Id: I02f2089859c2deccf0e6c451bf80da07893cc3f0 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/widgets/graphicsview')
-rw-r--r--src/widgets/graphicsview/qgraphicsitem_p.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/widgets/graphicsview/qgraphicsitem_p.h b/src/widgets/graphicsview/qgraphicsitem_p.h
index bf788d2c39..fe4bac12bc 100644
--- a/src/widgets/graphicsview/qgraphicsitem_p.h
+++ b/src/widgets/graphicsview/qgraphicsitem_p.h
@@ -353,6 +353,7 @@ public:
}
struct ExtraStruct {
+ ExtraStruct() {} // for QVector, don't use
ExtraStruct(Extra type, QVariant value)
: type(type), value(value)
{ }
@@ -364,7 +365,7 @@ public:
{ return type < extra; }
};
- QList<ExtraStruct> extras;
+ QVector<ExtraStruct> extras;
QGraphicsItemCache *maybeExtraItemCache() const;
QGraphicsItemCache *extraItemCache() const;
@@ -584,6 +585,7 @@ public:
int globalStackingOrder;
QGraphicsItem *q_ptr;
};
+Q_DECLARE_TYPEINFO(QGraphicsItemPrivate::ExtraStruct, Q_MOVABLE_TYPE);
struct QGraphicsItemPrivate::TransformData
{