Skip to content

frontend: Restore OBS wrappers in callbacks - #13978

Merged
RytoEX merged 1 commit into
obsproject:masterfrom
prgmitchell:fixGroupsCrash
Oct 2, 2026
Merged

RytoEX merged 1 commit into
obsproject:masterfrom
prgmitchell:fixGroupsCrash

Conversation

@prgmitchell

@prgmitchell prgmitchell commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Description

Restore OBS wrappers so objects stay alive until their callbacks run.

Fixes #13892

Motivation and Context

Crash reported in the #beta-testing discord channel, found to be related to 4abbcf0#diff-5dda35cfd7b6e95cb91853a82d1dccb95f0bae257faa880919b98873e503fe3cL203

How Has This Been Tested?

On v33 beta 5 removing a group with sources in it causes a crash, after this change it does not crash.

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.

@RytoEX RytoEX added this to the OBS Studio 33.0 milestone Oct 1, 2026
@RytoEX RytoEX added the kind/bug Categorizes issue or PR as related to a bug. label Oct 1, 2026
Restore OBS wrappers so objects stay alive until their callbacks run.
@PatTheMav

Copy link
Copy Markdown
Member

Where those originally wrappers and then "unwrapped" in a recent code change?

@prgmitchell

prgmitchell commented Oct 1, 2026 •

Copy link
Copy Markdown
Member Author

Where those originally wrappers and then "unwrapped" in a recent code change?

Yes changed in 4abbcf0#diff-5dda35cfd7b6e95cb91853a82d1dccb95f0bae257faa880919b98873e503fe3cL203

Full discussion with Warchamp in the #beta-testing channel on Discord if you want to look as well

@Warchamp7

Copy link
Copy Markdown
Member

Where those originally wrappers and then "unwrapped" in a recent code change?

Yeah, I suspect we're papering over an actual issue here, but these were wrappers before and things "worked", so this PR is restoring at least the old structure.

@xtfo

xtfo commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Fixes #13892.

@PatTheMav

Copy link
Copy Markdown
Member

Where those originally wrappers and then "unwrapped" in a recent code change?

Yeah, I suspect we're papering over an actual issue here, but these were wrappers before and things "worked", so this PR is restoring at least the old structure.

The actual reason for the crash is that when the group is removed, the destruction of the underlying scene does not happen on the main thread, but on our task thread which takes care of "deferred" deletions.

So when a group with an item is deleted, the code will ping-pong between the task thread and the main thread, including the destructor of SourceTreeItem which will also attempt to get a strong reference to the wrapped media source that is actively being destroyed by the task thread.

In that specific case using the wrappers seems to indeed paper over a lot of lifetime issues.

I'm not so convinced about the other rollbacks in this PR, but I guess it's fine to be overly cautious now and revisit later.

@Warchamp7

Copy link
Copy Markdown
Member

Where those originally wrappers and then "unwrapped" in a recent code change?

Yeah, I suspect we're papering over an actual issue here, but these were wrappers before and things "worked", so this PR is restoring at least the old structure.

The actual reason for the crash is that when the group is removed, the destruction of the underlying scene does not happen on the main thread, but on our task thread which takes care of "deferred" deletions.

So when a group with an item is deleted, the code will ping-pong between the task thread and the main thread, including the destructor of SourceTreeItem which will also attempt to get a strong reference to the wrapped media source that is actively being destroyed by the task thread.

In that specific case using the wrappers seems to indeed paper over a lot of lifetime issues.

I'm not so convinced about the other rollbacks in this PR, but I guess it's fine to be overly cautious now and revisit later.

Yep, I came to the same conclusion.

@RytoEX
RytoEX merged commit 04d8967 into obsproject:master Oct 2, 2026
15 checks passed
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

Status: Merged

Development

Successfully merging this pull request may close these issues.

OBS Studio crashes after removing a Group with a source in it

5 participants