Bug 1452204 part 1 - Correctly set walkCallingThread. r=glandium

GetCurrentThread() returns a pseudo handle, so comparing it against
the passed in argument doesn't make sense in most cases. This patch
changes it to using the thread id for comparison, which is guaranteed
to be unique in the whole lifetime of a thread.

MozReview-Commit-ID: 5TNAgLkcS6m

--HG--
extra : rebase_source : 0e72e8f6196c8079086ca697b9a121c6987ef43e
This commit is contained in:
Xidorn Quan 2018-06-04 19:17:32 +10:00
parent 7e7387d0a3
commit 7025ae7cbc

View File

@ -507,9 +507,15 @@ MozStackWalkThread(MozWalkStackCallback aCallback, uint32_t aSkipFrames,
return;
}
HANDLE currentThread = ::GetCurrentThread();
HANDLE targetThread = aThread ? aThread : currentThread;
data.walkCallingThread = (targetThread == currentThread);
HANDLE targetThread = aThread;
if (!aThread) {
targetThread = ::GetCurrentThread();
data.walkCallingThread = true;
} else {
DWORD threadId = ::GetThreadId(aThread);
DWORD currentThreadId = ::GetCurrentThreadId();
data.walkCallingThread = (threadId == currentThreadId);
}
// Have to duplicate handle to get a real handle.
if (!myProcess) {