Skip to content

Refactor ConfigFile#187

Merged
DanielaOrtner merged 1 commit into
RebelToolbox:mainfrom
madmiraal:refactor-config-file
Jul 22, 2025
Merged

Refactor ConfigFile#187
DanielaOrtner merged 1 commit into
RebelToolbox:mainfrom
madmiraal:refactor-config-file

Conversation

@madmiraal
Copy link
Copy Markdown
Contributor

This PR refactors [ConfigFile](https://docs.rebeltoolbox.com/en/latest/api/class_configfile.html) which includes:

  • Addressing four memory leaks:
    When loading or saving encrypted files, the _internal_save() and _internal_load() methods do not delete the FileAccess object f.
    if (err) {
    memdelete(fae);
    memdelete(f);
    return err;
    }
    return _internal_save(fae);
  • Making methods that create heap objects responsible for deleting them.
  • Making the save methods const.
  • Removing duplicate code.
  • Hiding implementation details by moving private methods to an anonymous namespace in the definition file.
  • Minimising the size of the header file by using forward declares instead of includes.

This should make ConfigFile easier to troubleshoot and maintain, while applying good coding practices and improving compile times.

@madmiraal madmiraal added the PR Type: Bug Fix Your current game should now work as expected. label Jul 22, 2025
@DanielaOrtner DanielaOrtner self-requested a review July 22, 2025 15:08
@DanielaOrtner DanielaOrtner merged commit 01996fe into RebelToolbox:main Jul 22, 2025
15 checks passed
@madmiraal madmiraal deleted the refactor-config-file branch July 23, 2025 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR Type: Bug Fix Your current game should now work as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants