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>
This commit is contained in:
Ulf Hermann 2016-12-20 11:33:53 +01:00
parent c7025b456e
commit 9727dd069f
1 changed files with 2 additions and 3 deletions

View File

@ -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;
}