From 9727dd069f4deeb69730d454d1ce6c5f9ed18e65 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 20 Dec 2016 11:33:53 +0100 Subject: 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 --- src/qml/jsruntime/qv4profiling_p.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/qml/jsruntime/qv4profiling_p.h') 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; } -- cgit v1.2.3