Skip to content

Commit 36fd56e

Browse files
committed
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`.
1 parent fb4d98b commit 36fd56e

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

libobs/obs.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -645,10 +645,14 @@ static int obs_init_video_mix(struct obs_video_info *ovi, struct obs_core_video_
645645

646646
gs_enter_context(obs->video.graphics);
647647

648-
if (video->gpu_conversion && !obs_init_gpu_conversion(video))
648+
if (video->gpu_conversion && !obs_init_gpu_conversion(video)) {
649+
gs_leave_context();
649650
return OBS_VIDEO_FAIL;
650-
if (!obs_init_textures(video))
651+
}
652+
if (!obs_init_textures(video)) {
653+
gs_leave_context();
651654
return OBS_VIDEO_FAIL;
655+
}
652656

653657
gs_leave_context();
654658

0 commit comments

Comments
 (0)