Changeset - r25368:ce512f9277c7
[Not reviewed]
master
0 1 0
Milek7 - 3 years ago 2021-05-02 18:10:07
Milek7@users.noreply.github.com
Codechange: Acquire video buffer before taking game state lock to prevent erratic fast forward behaviour (#9140)
1 file changed with 3 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/video/video_driver.cpp
Show inline comments
 
@@ -131,13 +131,14 @@ void VideoDriver::Tick()
 
			this->fast_forward_via_key = false;
 
		}
 

	
 
		/* Locking video buffer can block (especially with vsync enabled), do it before taking game state lock. */
 
		this->LockVideoBuffer();
 

	
 
		{
 
			/* Tell the game-thread to stop so we can have a go. */
 
			std::lock_guard<std::mutex> lock_wait(this->game_thread_wait_mutex);
 
			std::lock_guard<std::mutex> lock_state(this->game_state_mutex);
 

	
 
			this->LockVideoBuffer();
 

	
 
			this->DrainCommandQueue();
 

	
 
			while (this->PollEvent()) {}
0 comments (0 inline, 0 general)