frontend: Ensure pending profile changes are saved#13182
Open
Warchamp7 wants to merge 1 commit intoobsproject:masterfrom
Open
frontend: Ensure pending profile changes are saved#13182Warchamp7 wants to merge 1 commit intoobsproject:masterfrom
Warchamp7 wants to merge 1 commit intoobsproject:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Saves the current active profile config data to disk when:
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
InitBasicConfigDefaults2and 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 inActivateProfilewhich means most of those values are transparently set up again but we do not callInitBasicConfigDefaults2. 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
Checklist: