bombomby / optick

C++ Profiler For Games
https://optick.dev
MIT License
2.95k stars 296 forks source link

UE Plugin: fix deadlock in FOptickPlugin::StopCapture #176

Open Snowball2012 opened 2 years ago

Snowball2012 commented 2 years ago

This PR fixes an issue described here: https://github.com/bombomby/optick/issues/170

Optick::Update acquires coreLock and then tries to acquire UpdateCriticalSection lock if the capture has been stopped, while FOptickPlugin::OnEndFrameRT locks UpdateCriticalSection first and then tries to acquire coreLock, which results in a deadlock.

The proposed solution is to acquire UpdateCriticalSection lock each time coreLock is about to be acquired