forked from qt-creator/qt-creator
QmlProfiler: Avoid QHash::equal_range()
It was only introduced in Qt 5.7. Change-Id: I5f810c7244b8e8551c3249d8a8f7c6625185692e Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -172,17 +172,18 @@ void QmlProfilerDetailsRewriter::clearRequests()
|
|||||||
|
|
||||||
void QmlProfilerDetailsRewriter::documentReady(QmlJS::Document::Ptr doc)
|
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
|
// this could be triggered by an unrelated reload in Creator
|
||||||
if (range.first == range.second)
|
if (first == m_pendingEvents.end())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// if the file could not be opened this slot is still triggered
|
// if the file could not be opened this slot is still triggered
|
||||||
// but source will be an empty string
|
// but source will be an empty string
|
||||||
QString source = doc->source();
|
QString source = doc->source();
|
||||||
const bool sourceHasContents = !source.isEmpty();
|
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)
|
if (sourceHasContents)
|
||||||
rewriteDetailsForLocation(source, doc, it->requestId, it->location);
|
rewriteDetailsForLocation(source, doc, it->requestId, it->location);
|
||||||
it = m_pendingEvents.erase(it);
|
it = m_pendingEvents.erase(it);
|
||||||
|
|||||||
Reference in New Issue
Block a user