Skip to content

Commit 674cc39

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 674cc39

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

libobs/obs.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,13 +646,16 @@ static int obs_init_video_mix(struct obs_video_info *ovi, struct obs_core_video_
646646
gs_enter_context(obs->video.graphics);
647647

648648
if (video->gpu_conversion && !obs_init_gpu_conversion(video))
649-
return OBS_VIDEO_FAIL;
649+
goto fail;
650650
if (!obs_init_textures(video))
651-
return OBS_VIDEO_FAIL;
651+
goto fail;
652652

653653
gs_leave_context();
654654

655655
return OBS_VIDEO_SUCCESS;
656+
fail:
657+
gs_leave_context();
658+
return OBS_VIDEO_FAIL;
656659
}
657660

658661
struct obs_core_video_mix *obs_create_video_mix(struct obs_video_info *ovi)

0 commit comments

Comments
 (0)