UI: Fix mem leak if --disable-missing-files-check - #11075
Open
kamalmostafa wants to merge 1 commit into
Open
Conversation
PatTheMav
reviewed
Aug 6, 2024
Member
There was a problem hiding this comment.
The bugfix is a bit messy, but that's because of the original implementation is messy to begin with:
AddMissingFileswill automagically callobs_missing_files_createwhenobs_source_get_missing_filesis called (because that function has two fallback paths that create a new struct)obs_load_sourcesis only used in this single instance in the entire application, so its only purpose is to provide theAddMissingFilescallback when loading sources- This suggests that the check for missing files is an architectural fixture, not an "optional" feature (as the startup argument suggests)
- The memory allocated by
obs_missing_files_create(which is always allocated somehow) is only explicitly released whenShowMissingFilesDialogis called:- Either no files are missing, so
obs_missing_files_destroyis called directly - The
OBSMissingFilesinstance initialised is deallocated at some point (because it's destructor callsobs_missing_files_destroy.
- Either no files are missing, so
This change only fixes the symptoms of the underlying architectural issue (e.g. the memory is allocated independently from UI functionality and thus should also be released independently from showing any dialogs), but it does avoid the memory leak.
WizardCM
reviewed
Aug 10, 2024
Make the --disable-missing-files-check flag actually inhibit the collection of a `files` list, not just the display of the missing files dialog. Fixes a memory leak of the `files` list itself when the flag is used (and there are some missing files). Closes: obsproject#11074
kamalmostafa
force-pushed
the
kamal/fix-missing-files-leak
branch
from
August 10, 2024 23:44
ba1fbec to
aef41f5
Compare
6 tasks
Member
|
Please rebase this PR and give it another pass to make it ready for review/merging again. Cursory check makes this approach preferable to the one in #12628. |
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
Make the --disable-missing-files-check flag actually inhibit the collection of a
fileslist, not just the display of the missing files dialog.Fixes a memory leak of the
fileslist itself when the flag is used (and there are some missing files).Closes: #11074
Motivation and Context
Fix memory leak: #11074
How Has This Been Tested?
Manual testing of consistent behavior.
Types of changes
Checklist: