Bug 1373281 - Null-check mStackToFill before collecting psuedostacks, r=froydnj

This was causing a crash on nightly. The browser would try to collect only a
native stack, and then attempt to dereference the null pointer for the
pseudostack. I think this didn't happen on infra as it only occurs when the user
has hung a sufficient number of times.

MozReview-Commit-ID: 6RSW2llKBjT
This commit is contained in:
Michael Layzell
2017-06-15 11:58:22 -04:00
parent 8647454930
commit 18a05cd35b

View File

@@ -132,7 +132,11 @@ ThreadStackHelper::GetStacksInternal(Stack* aStack, NativeStack* aNativeStack)
#endif
auto callback = [&, this] (void** aPCs, size_t aCount) {
FillStackBuffer();
#ifdef MOZ_THREADSTACKHELPER_PSEUDO
if (mStackToFill) {
FillStackBuffer();
}
#endif
#ifdef MOZ_THREADSTACKHELPER_NATIVE
if (mNativeStackToFill) {
@@ -144,9 +148,11 @@ ThreadStackHelper::GetStacksInternal(Stack* aStack, NativeStack* aNativeStack)
#endif
};
profiler_suspend_and_sample_thread(mThreadId,
callback,
/* aSampleNative = */ !!aNativeStack);
if (mStackToFill || mNativeStackToFill) {
profiler_suspend_and_sample_thread(mThreadId,
callback,
/* aSampleNative = */ !!aNativeStack);
}
#endif
}