diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-04-15 11:31:20 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-04-16 09:46:00 +0000 |
commit | 198190b76baffce9b983d03749e64af6f8428e49 (patch) | |
tree | 2563051d164491839cb9926a1c5d8c96c20683c5 /src/corelib/tools/qlist.h | |
parent | aea74dcaee2d6930e4d69cbda83088703b45816e (diff) |
QList: make QListSpecialMethods dtors protected
QList publicly inherits from QListSpecialMethods. Thus, any specialisation
of QListSpecialMethods should make their destructor protected, to avoid
deletion through a pointer to QListSpecialMethods invoking UB.
Change-Id: I7e317606f84826cc0faf1bfc05dee97da6eaf2eb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qlist.h')
-rw-r--r-- | src/corelib/tools/qlist.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 57e67d52d7..f5ff952f97 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -62,8 +62,13 @@ QT_BEGIN_NAMESPACE template <typename T> class QVector; template <typename T> class QSet; -template <typename T> struct QListSpecialMethods { }; +template <typename T> struct QListSpecialMethods +{ +protected: + ~QListSpecialMethods() {} +}; template <> struct QListSpecialMethods<QByteArray>; +template <> struct QListSpecialMethods<QString>; struct Q_CORE_EXPORT QListData { // tags for tag-dispatching of QList implementations, |