Skip to content

frontend: Ensure pending profile changes are saved#13182

Open
Warchamp7 wants to merge 1 commit intoobsproject:masterfrom
Warchamp7:profile-defaults-file
Open

frontend: Ensure pending profile changes are saved#13182
Warchamp7 wants to merge 1 commit intoobsproject:masterfrom
Warchamp7:profile-defaults-file

Conversation

@Warchamp7
Copy link
Member

Description

Saves the current active profile config data to disk when:

  • Renaming a profile
  • Duplicating a profile
  • Activating a profile

Motivation and Context

#11465 fixed an issue where profiles were loaded before all modules were ready, which would cause settings to 'reset' due to the encoders being missing.

However this seems to have caused the side effect noted in #12458 where renaming/duplicating a fresh profile would crash upon opening settings. This is due to null values for AdvOut -> AudioEncoder / RecAudioEncoder.

The defaults for those values come from InitBasicConfigDefaults2 and never get persisted to disk prior to the Rename/Duplicate. The Rename/Duplicate functions create a new profile file and then copy the current profile over it. This means any unsaved profile data which are not saved to disk yet (In the example scenario, pretty much all of them) is lost. We re-initialize defaults in ActivateProfile which means most of those values are transparently set up again but we do not call InitBasicConfigDefaults2. Thus anything set up there is not initialized in the copied profile.

The fix in this PR addresses the problem above and also solves a theoretical scenario where unsaved profile data is currently lost when doing Rename/Duplicate. I'm not actually sure if there's anywhere we are guilty of this, but it is solved all the same.

How Has This Been Tested?

Launched OBS in Portable mode. With the freshly created Untitled profile, I can open Settings. If I Rename or Duplicate the profile and then open Settings, OBS will crash. With this fix it no longer crashes.

This crash can also be triggered by creating a brand new profile and then Renaming or Duplicating that new profile.

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.

@Warchamp7 Warchamp7 added the Bug Fix Non-breaking change which fixes an issue label Mar 2, 2026
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.

1 participant