Fix sampling profiler race condition
Thread 1 is running RunSamplingThread and has just read trace into
Thread 2 is calling Trace::Stop and has just suspended all the
threads. At this point thread 1 is blocked on the SuspendAll.
Thread 2 goes and deletes the trace which Thread 1 still has a
pointer to, calls ResumeAll(). At this point thread 1 suspends the
threads and adds samples to the just deleted trace.
The fix is to join the thread before we delete the trace.
1 file changed