From 1bb3a4ee739b43acb3fa77a3c8f2556543e54701 Mon Sep 17 00:00:00 2001 From: Wu Haoyu <3540385658@qq.com> Date: Thu, 30 Apr 2026 17:50:15 +0800 Subject: [PATCH] libobs: Make sure all code paths leave context Should always call `gs_leave_context` after `gs_enter_context` or it might cause a lock leave. This commit makes sure all code paths will call `gs_leave_context` if it called `gs_enter_context`. --- libobs/obs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libobs/obs.c b/libobs/obs.c index b5fce31ab..0c3e478b6 100644 --- a/libobs/obs.c +++ b/libobs/obs.c @@ -645,10 +645,14 @@ static int obs_init_video_mix(struct obs_video_info *ovi, struct obs_core_video_ gs_enter_context(obs->video.graphics); - if (video->gpu_conversion && !obs_init_gpu_conversion(video)) + if (video->gpu_conversion && !obs_init_gpu_conversion(video)) { + gs_leave_context(); return OBS_VIDEO_FAIL; - if (!obs_init_textures(video)) + } + if (!obs_init_textures(video)) { + gs_leave_context(); return OBS_VIDEO_FAIL; + } gs_leave_context();