This CL fixes a crash that could happen when JSON event tracing is shutting down. The cause of the crash was the fact that the logger thread function was returning 'true', causing the platform thread to run it repeatedly even though that wasn't the intention. Usually the EventLogger::Stop() function would set the event requesting the logging thread to clean up and close the file, and then immediately call PlatformThread::Stop() which would stop the outer loop. The Log() function would only run once and everything behaves as expected. However, if a context switch happens between the shutdown_event_.Set() and logging_thread_.Stop() calls in EventLogger::Stop(), the logger thread function would close the file and exit the Log() method, while PlatformThread will rerun it again. So the Log() function runs twice, and the second time output_file_ is NULL which either causes the DCHECK to fail (in debug builds) or the fprintf() to crash with SIGSEGV (in release builds). The fix simply changes the return value of the thread function to false so it never runs twice. R=pthatcher@webrtc.org Review URL: https://codereview.webrtc.org/2168283002 . Cr-Commit-Position: refs/heads/master@{#13510}
Name: WebRTC URL: http://www.webrtc.org Version: 90 License: BSD License File: LICENSE Description: WebRTC provides real time voice and video processing functionality to enable the implementation of PeerConnection/MediaStream. Third party code used in this project is described in the file LICENSE_THIRD_PARTY.