From 31e2fcc8934ef3fac9a584ed966d929e63fcc069 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 20 Dec 2016 17:23:54 +0100 Subject: [PATCH] QmlProfiler: Avoid QHash::equal_range() It was only introduced in Qt 5.7. Change-Id: I5f810c7244b8e8551c3249d8a8f7c6625185692e Reviewed-by: Christian Kandeler --- src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.cpp b/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.cpp index 0c75e10008a..c7ca5aa3066 100644 --- a/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.cpp @@ -172,17 +172,18 @@ void QmlProfilerDetailsRewriter::clearRequests() void QmlProfilerDetailsRewriter::documentReady(QmlJS::Document::Ptr doc) { - auto range = m_pendingEvents.equal_range(doc->fileName()); + const QString &fileName = doc->fileName(); + auto first = m_pendingEvents.find(fileName); // this could be triggered by an unrelated reload in Creator - if (range.first == range.second) + if (first == m_pendingEvents.end()) return; // if the file could not be opened this slot is still triggered // but source will be an empty string QString source = doc->source(); const bool sourceHasContents = !source.isEmpty(); - for (auto it = range.first; it != range.second;) { + for (auto it = first; it != m_pendingEvents.end() && it.key() == fileName;) { if (sourceHasContents) rewriteDetailsForLocation(source, doc, it->requestId, it->location); it = m_pendingEvents.erase(it);