From b3364cd8bf5ec6dc6d58dcb82c8285d6b3700a7a Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 9 Jul 2015 21:40:58 +0200 Subject: [PATCH] QLineEdit: don't hold SideWidgetEntry's in a QList SideWidgetEntry 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: Ia87b9ac634ad9386bc667355e6e236bc3d56ab29 Reviewed-by: Friedemann Kleint Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/widgets/qlineedit_p.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h index 4654262ea73..57055757ebd 100644 --- a/src/widgets/widgets/qlineedit_p.h +++ b/src/widgets/widgets/qlineedit_p.h @@ -111,7 +111,7 @@ public: QAction *action; int flags; }; - typedef QList SideWidgetEntryList; + typedef QVector SideWidgetEntryList; QLineEditPrivate() : control(0), frame(1), contextMenuEnabled(1), cursorVisible(0), @@ -225,6 +225,7 @@ private: int lastTextSize; mutable QSize m_iconSize; }; +Q_DECLARE_TYPEINFO(QLineEditPrivate::SideWidgetEntry, Q_PRIMITIVE_TYPE); inline int QLineEditPrivate::effectiveLeftTextMargin() const {