From 730dcd9a93ff6ae5e2d46bd95878d9224ebfbea4 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Mon, 4 May 2026 13:34:34 +1000 Subject: [PATCH] VideoThread: Assert not on thread for async calls --- src/core/video_thread.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/core/video_thread.cpp b/src/core/video_thread.cpp index 242a47a4d..0a86e3dba 100644 --- a/src/core/video_thread.cpp +++ b/src/core/video_thread.cpp @@ -1151,6 +1151,8 @@ void VideoThread::UpdateSettingsOnThread(GPUSettings&& new_settings) void VideoThread::RunOnThread(AsyncCallType func) { + DebugAssert(!VideoThread::IsOnThread()); + if (!s_state.use_thread) [[unlikely]] { func(); @@ -1164,6 +1166,8 @@ void VideoThread::RunOnThread(AsyncCallType func) void VideoThread::RunOnThreadAndSync(AsyncCallType func) { + DebugAssert(!VideoThread::IsOnThread()); + if (!s_state.use_thread) [[unlikely]] { func(); @@ -1177,6 +1181,8 @@ void VideoThread::RunOnThreadAndSync(AsyncCallType func) std::pair VideoThread::BeginASyncBufferCall(AsyncBufferCallType func, u32 buffer_size) { + DebugAssert(!VideoThread::IsOnThread()); + // this is less than optimal, but it's only used for input osd updates currently, so whatever VideoThreadAsyncBufferCallCommand* const cmd = AllocateCommand( sizeof(VideoThreadAsyncBufferCallCommand) + buffer_size, VideoThreadCommandType::AsyncBufferCall, func); @@ -1186,6 +1192,8 @@ std::pair VideoThread::BeginASyncBufferCall(AsyncBuf void VideoThread::EndASyncBufferCall(VideoThreadCommand* cmd) { + DebugAssert(!VideoThread::IsOnThread()); + if (!s_state.use_thread) [[unlikely]] { VideoThreadAsyncBufferCallCommand* const acmd = static_cast(cmd);