diff options
author | Brad King <brad.king@kitware.com> | 2020-07-22 19:16:12 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-07-22 19:19:51 (GMT) |
commit | af6cf586f63654f1c9d4e78b3acfafa2cfecae57 (patch) | |
tree | ca82ae11bbb94f1022770a00739c4bc219d53612 | |
parent | d421274e3e11a0e6480358faa8a8e5cf48d7b3c2 (diff) | |
download | CMake-af6cf586f63654f1c9d4e78b3acfafa2cfecae57.zip CMake-af6cf586f63654f1c9d4e78b3acfafa2cfecae57.tar.gz CMake-af6cf586f63654f1c9d4e78b3acfafa2cfecae57.tar.bz2 |
cmake-gui: Fix crash when built with Qt 5.14 or later
In commit d7679f6427 (QCMakeCacheView: use non-deprecated List and Set
constructions, 2020-06-10, v3.18.0-rc2~13^2) the conversion of the
`this->properties()` value to QSet is incorrect for Qt 5.14+. The
problem is that `this->properties()` returns by value, so the range
`this->properties().begin(), this->properties().end()` provides
iterators to two different instances. Use an intermediate temporary
copy of the value to get a consistent iterator range.
Fixes: #20981
-rw-r--r-- | Source/QtDialog/QCMakeCacheView.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx index b1f4a82..9b24fbd 100644 --- a/Source/QtDialog/QCMakeCacheView.cxx +++ b/Source/QtDialog/QCMakeCacheView.cxx @@ -226,8 +226,9 @@ void QCMakeCacheModel::setProperties(const QCMakePropertyList& props) #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) QSet<QCMakeProperty> oldProps = this->properties().toSet(); #else - QSet<QCMakeProperty> oldProps = QSet<QCMakeProperty>( - this->properties().begin(), this->properties().end()); + QCMakePropertyList const& oldPropsList = this->properties(); + QSet<QCMakeProperty> oldProps = + QSet<QCMakeProperty>(oldPropsList.begin(), oldPropsList.end()); #endif oldProps.intersect(newProps); newProps.subtract(oldProps); |