diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2018-01-08 11:47:01 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2018-01-09 07:55:04 +0000 |
commit | 53985897ef09a88cd2121962405decf355974e6f (patch) | |
tree | 540aafe5a32c9c013a008e0ba9bd3bafe2e87bc1 /src/qml/debugger | |
parent | b6ed2c325195c4a5644d1bdf4fae0d5fc606ec9e (diff) |
QML Profiler: Don't assume a non-null object in RefLocation
The default value is indeed null, and we may set a locationType even if
the object stays null, e.g. for qsTr() bindings.
Task-number: QTBUG-65611
Change-Id: I8231602642fa1f9b94567365bbdaaf109ea710dd
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/debugger')
-rw-r--r-- | src/qml/debugger/qqmlprofiler_p.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/qml/debugger/qqmlprofiler_p.h b/src/qml/debugger/qqmlprofiler_p.h index ef38887303..7800b24076 100644 --- a/src/qml/debugger/qqmlprofiler_p.h +++ b/src/qml/debugger/qqmlprofiler_p.h @@ -163,9 +163,8 @@ public: // be available anymore when we send the data. struct RefLocation : public Location { RefLocation() - : Location(), locationType(MaximumRangeType), sent(false) + : Location(), locationType(MaximumRangeType), something(nullptr), sent(false) { - function = nullptr; } RefLocation(QV4::Function *ref) @@ -226,6 +225,9 @@ public: void addref() { + if (isNull()) + return; + switch (locationType) { case Binding: function->compilationUnit->addref(); @@ -247,6 +249,9 @@ public: void release() { + if (isNull()) + return; + switch (locationType) { case Binding: function->compilationUnit->release(); @@ -271,12 +276,18 @@ public: return locationType != MaximumRangeType; } + bool isNull() const + { + return !something; + } + RangeType locationType; union { QV4::Function *function; QV4::CompiledData::CompilationUnit *unit; QQmlBoundSignalExpression *boundSignal; QQmlDataBlob *blob; + void *something; }; bool sent; }; |