Skip to content

Conversation

@dsaedtler
Copy link
Contributor

@dsaedtler dsaedtler commented Oct 23, 2025

Description

Makes some changes to how canvas removal is handled to avoid recursion in the middle of an erase() operation on the vector holding frontend-managed canvases.

Also prevents a similar issue when clearing scene data by replacing .clear() with a dedicated method that also ensures the canvas removal signal is properly fired for each removed canvas.

Motivation and Context

See #12728, which this PR superseedes.

How Has This Been Tested?

Reproduced using the following snipped (just added to the end of the OBSBasicSettings::OBSBasicSettings() constructor):

	obs_video_info ovi;
	obs_get_video_info(&ovi);
	OBSCanvasAutoRelease cv = obs_frontend_add_canvas("test", &ovi, PROGRAM);
	obs_frontend_remove_canvas(cv);
	OBSCanvasAutoRelease cv2 = obs_frontend_add_canvas("test2", &ovi, PROGRAM);

Note that the crash only happens in release builds, not debug.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Tweak (non-breaking change to improve existing functionality)

Checklist:

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

@WizardCM WizardCM added Bug Fix Non-breaking change which fixes an issue Enhancement Improvement to existing functionality labels Oct 25, 2025
@RytoEX RytoEX requested a review from PatTheMav October 30, 2025 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Fix Non-breaking change which fixes an issue Enhancement Improvement to existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants