diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2016-12-20 11:33:53 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2016-12-20 11:36:45 +0000 |
commit | 9727dd069f4deeb69730d454d1ce6c5f9ed18e65 (patch) | |
tree | a3e8e907c635680cfa2db92a9ca983a1baee987a | |
parent | c7025b456e551596907f82a27cb1991caa9fde4e (diff) |
V4 Profiler: Don't delete compilation units when copying trace data
If the trace data is the only thing holding a reference to a particular
compilation unit and we are copying the last FunctionCall from that
compilationUnit onto the second last, we have to first addref() and
then release() as otherwise it might disappear in between.
Also we don't need to check m_function for null, as the ctor guarantees
it is never null.
Change-Id: I6eaf64abe71f9785d4e76e18dabd9a0676564da1
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r-- | src/qml/jsruntime/qv4profiling_p.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4profiling_p.h b/src/qml/jsruntime/qv4profiling_p.h index d27e853343..f75ac4d33a 100644 --- a/src/qml/jsruntime/qv4profiling_p.h +++ b/src/qml/jsruntime/qv4profiling_p.h @@ -158,12 +158,11 @@ public: FunctionCall &operator=(const FunctionCall &other) { if (&other != this) { - if (m_function) - m_function->compilationUnit->release(); + other.m_function->compilationUnit->addref(); + m_function->compilationUnit->release(); m_function = other.m_function; m_start = other.m_start; m_end = other.m_end; - m_function->compilationUnit->addref(); } return *this; } |