summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qresultstore.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2017-02-27 12:13:13 +0100
committerOlivier Goffart (Woboq GmbH) <ogoffart@woboq.com>2017-03-06 18:32:28 +0000
commit6797570a59529b90b5a28923825b56703173fa56 (patch)
treec8fed7fd055446518bf1ceee7bf71a7d577b9cee /src/corelib/thread/qresultstore.cpp
parenta170c974a53bde5c6027d3cb25311b819678c546 (diff)
Fix UB in QFutureInterface: invalid casts from ResultStoreBase to ResultStore<>
ResultStore never actually exists, only ResutStoreBase does. So casting to ResultStore<T> and calling its member functions is UB. Put the type dependent function as template member functions within ResultStoreBase and so we don't need QtPrivate::ResultStore anymore. Same goes for the iterator. Change-Id: I739b9d234ba2238977863df77fde3a4471a9abd2 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/corelib/thread/qresultstore.cpp')
-rw-r--r--src/corelib/thread/qresultstore.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/corelib/thread/qresultstore.cpp b/src/corelib/thread/qresultstore.cpp
index aa7ec02d6e..9a6fcec678 100644
--- a/src/corelib/thread/qresultstore.cpp
+++ b/src/corelib/thread/qresultstore.cpp
@@ -98,6 +98,12 @@ bool ResultIteratorBase::canIncrementVectorIndex() const
ResultStoreBase::ResultStoreBase()
: insertIndex(0), resultCount(0), m_filterMode(false), filteredResults(0) { }
+ResultStoreBase::~ResultStoreBase()
+{
+ // QFutureInterface's dtor must delete the contents of m_results.
+ Q_ASSERT(m_results.isEmpty());
+}
+
void ResultStoreBase::setFilterMode(bool enable)
{
m_filterMode = enable;