summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergio Martins <iamsergio@gmail.com>2016-01-23 01:00:53 +0000
committerSean Harmer <sean.harmer@kdab.com>2016-01-23 16:14:55 +0000
commitc77b076fa4cc19bd3196b137bfc0ce7d2ca9a88e (patch)
tree3b9b2e6657ab01e5ab684efbeb5d67a08ed6c8d5
parentc7bf10747b563cf62bbf2160e09e247998286c6c (diff)
Fix potential crash due to taking iterator from temporary container
constBegin() would belong to a different container than constEnd() Change-Id: I5094d6a6ee9c2167bb69274556f568538c77cf6f Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r--tools/qgltf/qgltf.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/tools/qgltf/qgltf.cpp b/tools/qgltf/qgltf.cpp
index cd6f23280..9486070f8 100644
--- a/tools/qgltf/qgltf.cpp
+++ b/tools/qgltf/qgltf.cpp
@@ -2340,17 +2340,16 @@ void GltfExporter::save(const QString &inputFilename)
m_obj["meshes"] = meshes;
QJsonObject cameras;
- for (QHash<QString, Importer::CameraInfo>::const_iterator it = m_importer->cameraInfo().constBegin();
- it != m_importer->cameraInfo().constEnd(); ++it) {
+ foreach (const Importer::CameraInfo &camInfo, m_importer->cameraInfo()) {
QJsonObject camera;
QJsonObject persp;
- persp["aspect_ratio"] = it->aspectRatio;
- persp["yfov"] = it->yfov;
- persp["znear"] = it->znear;
- persp["zfar"] = it->zfar;
+ persp["aspect_ratio"] = camInfo.aspectRatio;
+ persp["yfov"] = camInfo.yfov;
+ persp["znear"] = camInfo.znear;
+ persp["zfar"] = camInfo.zfar;
camera["perspective"] = persp;
camera["type"] = QStringLiteral("perspective");
- cameras[it->name] = camera;
+ cameras[camInfo.name] = camera;
}
m_obj["cameras"] = cameras;