aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/debugger/qqmlprofiler_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/debugger/qqmlprofiler_p.h')
-rw-r--r--src/qml/debugger/qqmlprofiler_p.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/qml/debugger/qqmlprofiler_p.h b/src/qml/debugger/qqmlprofiler_p.h
index a220e9cfc8..54efbb5d73 100644
--- a/src/qml/debugger/qqmlprofiler_p.h
+++ b/src/qml/debugger/qqmlprofiler_p.h
@@ -238,14 +238,19 @@ public:
// produce. The +1 makes the pointer point into the middle of the QV4::Function. Thus it
// still points to valid memory but we cannot accidentally create a duplicate key from
// another object.
- quintptr locationId(id(function) + 1);
+ // If there is no function, use a static but valid address: The profiler itself.
+ quintptr locationId = function ? id(function) + 1 : id(this);
m_data.append(QQmlProfilerData(m_timer.nsecsElapsed(),
(1 << RangeStart | 1 << RangeLocation), Binding,
locationId));
RefLocation &location = m_locations[locationId];
- if (!location.isValid())
- location = RefLocation(function);
+ if (!location.isValid()) {
+ if (function)
+ location = RefLocation(function);
+ else // Make it valid without actually providing a location
+ location.locationType = Binding;
+ }
}
// Have toByteArrays() construct another RangeData event from the same QString later.