diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2014-08-16 20:28:10 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-06-24 13:14:35 +0000 |
commit | 931f9c23ee884fe929aed50404a29776826d8bd4 (patch) | |
tree | a9141e4e97ce04d00bc701a2570b2db4866978a7 /src/widgets/styles/qmacstyle_mac_p_p.h | |
parent | 5b6fd71d3a640900d5a938db2af053111e962fcf (diff) |
QMacStyle: replace a QSet<QPointer> with QVector<QPointer>
Holding a mutable item in a QSet violates QSet invariants, namely that in
bucket N, all items have hash % size == N. If a value gets reset to
nullptr by external means, that invariant no longer holds. The code works
by pure luck.
Replace the set with a vector, which doesn't care whether elements change
under the hood, and will also outperform the typical QSet use due to
better locality of reference.
Change-Id: Ied7940e82525fd0da9f74dfb0bc36a320b45d172
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/widgets/styles/qmacstyle_mac_p_p.h')
-rw-r--r-- | src/widgets/styles/qmacstyle_mac_p_p.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/widgets/styles/qmacstyle_mac_p_p.h index b09e81d595..33818568ec 100644 --- a/src/widgets/styles/qmacstyle_mac_p_p.h +++ b/src/widgets/styles/qmacstyle_mac_p_p.h @@ -86,7 +86,7 @@ #include <qdatetimeedit.h> #include <qmath.h> #include <qpair.h> -#include <qset.h> +#include <qvector.h> #include <QtWidgets/qgraphicsproxywidget.h> #include <QtWidgets/qgraphicsview.h> @@ -213,7 +213,7 @@ public: mutable QPointer<QObject> pressedButton; mutable QPointer<QObject> defaultButton; mutable QPointer<QObject> autoDefaultButton; - static QSet<QPointer<QObject> > scrollBars; + static QVector<QPointer<QObject> > scrollBars; struct ButtonState { int frame; |