Skip to content

Conversation

@ThePythonator
Copy link
Owner

Addresses #3. Does not entirely avoid raw pointers - sometimes they are still used in non-owning circumstances, and for holding BaseStage objects.
This PR means the code now avoids using new or delete for anything except creating and destroying stages. The destruction of stages is encapsulated in the can_delete_me parameter anyway, so memory leaks are less likely.

Use instances instead of pointers. Where pointers are needed,
the address of these objects can be given. This removes a small
amount of resource handling code in quit().
Use instances instead of pointers. Where pointers are needed,
the address of these objects can be given. This removes a small
amount of resource handling code in quit().
Use smart pointers instead of raw pointers for the Image class. This
removes a small amount of resource handling code in quit().
Avoid calling delete on raw pointers which ButtonImages contains,
since these pointers should be managed by smart pointers in
GraphicsObjects (in the vector of Image smart pointers).
Use smart pointers instead of raw pointers for the BaseTransition class.
This removes a small amount of resource handling code in quit().
Do not delete BaseTransition objects because the raw pointers are now
treated as non-owning (the smart pointers in GraphicsObjects actually
store the BaseTransition instances).
@ThePythonator ThePythonator force-pushed the chore/rework-to-avoid-raw-pointers branch from 942511d to 7691724 Compare June 28, 2025 22:38
@ThePythonator ThePythonator merged commit 3042c22 into main Jun 28, 2025
6 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants