Fix memory leaks by using Smart Pointers and RAII Wrappers#1
Closed
buzz wants to merge 1 commit intodeobfuscationfrom
Closed
Fix memory leaks by using Smart Pointers and RAII Wrappers#1buzz wants to merge 1 commit intodeobfuscationfrom
buzz wants to merge 1 commit intodeobfuscationfrom
Conversation
- Smart Pointer Usage - std::unique_ptr is used consistently for exclusive ownership - std::shared_ptr is used appropriately for shared resources (Font) - All new expressions are wrapped in std::make_unique or std::make_shared - RAII Wrappers - SDLWindow and SDLRenderer properly wrap SDL resources - Font::FontResource wraps SDL_RWops with proper cleanup - Image destructor calls SDL_FreeSurface - FileStream destructor calls close() - Static Resources - FontStorage::fontsMap uses std::shared_ptr<Font> - auto-cleanup on program exit - RecordStore::opened uses std::unique_ptr<RecordStore> - auto-cleanup on program exit - Font::FontResource singleton uses std::shared_ptr - auto-cleanup
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.
std::unique_ptris used consistently for exclusive ownershipstd::shared_ptris used appropriately for shared resources (Font)std::make_uniqueorstd::make_sharedSDLWindowandSDLRendererproperly wrap SDL resourcesFont::FontResourcewrapsSDL_RWopswith proper cleanupSDL_FreeSurfaceFileStreamdestructor callsclose()FontStorage::fontsMapusesstd::shared_ptr<Font>- auto-cleanup on program exitRecordStore::openedusesstd::unique_ptr<RecordStore>- auto-cleanup on program exitFont::FontResourcesingleton usesstd::shared_ptr- auto-cleanupDepends on rgimad#37 being merged first.