Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Fix crash when creating scene collections with "unsafe" names #11301

Merged
merged 1 commit into from
Sep 27, 2024

Conversation

PatTheMav
Copy link
Member

Description

Fixes possible crash when a new scene collection is created with a name that consists "unsafe" characters.

Motivation and Context

Scene collection names that are not considered "safe" by OBS Studio get a changed JSON file name with incompatible characters replaced.

The refactored scene collection implementation uses the Load function to either activate an existing scene collection or create a new one if it does not exist.

The Load function however overwrote the scene collection name set in the profile with its own variant based off the "safe" file name, which created a mismatch with the code that created the collection data model.

As the Load function is only called by ActivateSceneCollection (which itself already sets the name and filename for the collection), removal of this superfluous code in the Load function also fixes the issue.

How Has This Been Tested?

Tested on Windows 11 with a scene collection named "New Collection" which will be automatically stored in "New_Collection.json".

Types of changes

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

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.

Scene collection names that are not considered "safe" by OBS Studio
get a changed JSON file name with incompatible characters replaced.

The refactored scene collection implementation uses the Load function to
either activate an existing scene collection or create a new one if it
does not exist.

The Load function however overwrote the scene collection name set in
the profile with its own variant based off the "safe" file name, which
created a mismatch with the code that created the collection data
model.

As the Load function is only called by ActivateSceneCollection (which
itself already sets the name and filename for the collection), removal
of this superfluous code in the Load function also fixes the issue.
@PatTheMav PatTheMav added the Bug Fix Non-breaking change which fixes an issue label Sep 18, 2024
UI/window-basic-main.cpp Show resolved Hide resolved
@RytoEX RytoEX added this to the OBS Studio 31 milestone Sep 27, 2024
@RytoEX RytoEX merged commit b4137fa into obsproject:master Sep 27, 2024
14 checks passed
@PatTheMav PatTheMav deleted the scene-collection-name-fix branch September 28, 2024 02:46
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants