Skip to content

libobs: Make sure all code paths leave context#13375

Open
suogesi wants to merge 1 commit intoobsproject:masterfrom
suogesi:fix/13366
Open

libobs: Make sure all code paths leave context#13375
suogesi wants to merge 1 commit intoobsproject:masterfrom
suogesi:fix/13366

Conversation

@suogesi
Copy link
Copy Markdown

@suogesi suogesi commented Apr 30, 2026

Description

Not calling gs_leave_context after gs_enter_context can cause a lock leak. This PR makes sure all code paths in obs_init_video_mix from libobs/obs.c will do this.

Motivation and Context

#13366

This is NOT a complete fix of this issue. OBS should show error messages to remind users not to write such resolution because GPU cannot process it.

This PR makes "Stop Recording" work but the output is not as expected. (i.e., if you write "1920x1079" into Settings > Output (Advanced) > Recording > Rescale Output, you won't get a 1920x1079 video. Instead, you get a default resolution.)

How Has This Been Tested?

  1. Select "NVIDIA NVENC H.264" at Settings > Output (Advanced) > Recording > Video Encoder.
  2. Select "Bilinear" at Settings > Output (Advanced) > Recording > Rescale Output.
  3. Write "1920x1079" into Settings > Output (Advanced) > Recording > Rescale Output.
  4. Click "Start Recording".
  5. Click "Stop Recording".
  6. Video saved instead of keeping "Stopping Recording...".

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have read the contributing document.
  • My code has been run through clang-format.
  • My code follows the project's style guidelines
  • My code is not on the master branch.
  • My code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

Comment thread libobs/obs.c Outdated
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`.
@WizardCM WizardCM added the kind/bug Categorizes issue or PR as related to a bug. label May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Categorizes issue or PR as related to a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants