McRogueFace/src
John McCardle 062e4dadc4 Fix animation segfaults with RAII weak_ptr implementation
Resolved two critical segmentation faults in AnimationManager:
1. Race condition when creating multiple animations in timer callbacks
2. Exit crash when animations outlive their target objects

Changes:
- Replace raw pointers with std::weak_ptr for automatic target invalidation
- Add Animation::complete() to jump animations to final value
- Add Animation::hasValidTarget() to check if target still exists
- Update AnimationManager to auto-remove invalid animations
- Add AnimationManager::clear() call to GameEngine::cleanup()
- Update Python bindings to pass shared_ptr instead of raw pointers

This ensures animations can never reference destroyed objects, following
proper RAII principles. Tested with sizzle_reel_final.py and stress
tests creating/destroying hundreds of animated objects.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-12 10:21:48 -04:00
..
scripts Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
ActionCode.h Squashed commit of the following: [interpreter_mode] 2025-07-05 17:23:09 -04:00
Animation.cpp Fix animation segfaults with RAII weak_ptr implementation 2025-07-12 10:21:48 -04:00
Animation.h Fix animation segfaults with RAII weak_ptr implementation 2025-07-12 10:21:48 -04:00
CommandLineParser.cpp Squashed commit of the following: [interpreter_mode] 2025-07-05 17:23:09 -04:00
CommandLineParser.h Squashed commit of the following: [interpreter_mode] 2025-07-05 17:23:09 -04:00
Common.h Refactor: Python 3.12, build libtcod & SFML from source. Cmake build. Directory cleanup 2024-02-24 22:48:39 -05:00
GameEngine.cpp Fix animation segfaults with RAII weak_ptr implementation 2025-07-12 10:21:48 -04:00
GameEngine.h Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
HeadlessRenderer.cpp Squashed commit of the following: [interpreter_mode] 2025-07-05 17:23:09 -04:00
HeadlessRenderer.h Squashed commit of the following: [interpreter_mode] 2025-07-05 17:23:09 -04:00
IndexTexture.cpp Refactor: Python 3.12, build libtcod & SFML from source. Cmake build. Directory cleanup 2024-02-24 22:48:39 -05:00
IndexTexture.h Refactor: Python 3.12, build libtcod & SFML from source. Cmake build. Directory cleanup 2024-02-24 22:48:39 -05:00
main.cpp Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
McRFPy_API.cpp Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
McRFPy_API.h Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
McRFPy_Automation.cpp Squashed commit of the following: [interpreter_mode] 2025-07-05 17:23:09 -04:00
McRFPy_Automation.h Squashed commit of the following: [interpreter_mode] 2025-07-05 17:23:09 -04:00
McRFPy_Libtcod.cpp Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
McRFPy_Libtcod.h Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
McRogueFaceConfig.h Squashed commit of the following: [interpreter_mode] 2025-07-05 17:23:09 -04:00
PyAnimation.cpp Fix animation segfaults with RAII weak_ptr implementation 2025-07-12 10:21:48 -04:00
PyAnimation.h Fix animation segfaults with RAII weak_ptr implementation 2025-07-12 10:21:48 -04:00
PyArgHelpers.h Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
PyCallable.cpp Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
PyCallable.h Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
PyColor.cpp Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
PyColor.h Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
PyDrawable.cpp Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
PyDrawable.h Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
PyFont.cpp Squashed commit of the following: [alpha_streamline_1] 2025-07-05 18:56:02 -04:00
PyFont.h Squashed commit of the following: [alpha_streamline_1] 2025-07-05 18:56:02 -04:00
PyObjectUtils.h Iterators, other Python C API improvements 2025-05-31 09:11:51 -04:00
PyPositionHelper.h Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
PyRAII.h Iterators, other Python C API improvements 2025-05-31 09:11:51 -04:00
PyScene.cpp Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
PyScene.h Squashed commit of the following: [interpreter_mode] 2025-07-05 17:23:09 -04:00
PySceneObject.cpp Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
PySceneObject.h Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
PyTexture.cpp Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
PyTexture.h Squashed commit of the following: [alpha_streamline_1] 2025-07-05 18:56:02 -04:00
PyTimer.cpp hotfix: windows build, fresh docs 2025-07-10 16:34:46 -04:00
PyTimer.h Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
PyVector.cpp Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
PyVector.h Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
PyWindow.cpp Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
PyWindow.h Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
Resources.cpp Adding text functionality to Caption (why was that missing???) 2024-03-07 12:35:07 -05:00
Resources.h Adding text functionality to Caption (why was that missing???) 2024-03-07 12:35:07 -05:00
Scene.cpp Squashed commit of the following: [interpreter_mode] 2025-07-05 17:23:09 -04:00
Scene.h Squashed commit of the following: [interpreter_mode] 2025-07-05 17:23:09 -04:00
SceneTransition.cpp Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
SceneTransition.h Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
Timer.cpp Segfault fixes. Switching scenes broke some assumptions. All PyObject calls from userspace now handle (discard) exceptions and return values. 2024-03-08 12:09:09 -05:00
Timer.h Whoops, some issues with deleting timers. 2024-03-07 09:49:24 -05:00
UI.h Squashed commit of the following: [break_up_ui_h] 2024-04-20 10:32:04 -04:00
UIBase.h Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
UICaption.cpp Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
UICaption.h Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
UICollection.cpp Squashed commit of the following: [alpha_streamline_1] 2025-07-05 18:56:02 -04:00
UICollection.h Squashed commit of the following: [alpha_streamline_1] 2025-07-05 18:56:02 -04:00
UIContainerBase.h Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
UIDrawable.cpp Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
UIDrawable.h Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
UIEntity.cpp hotfix: windows build, fresh docs 2025-07-10 16:34:46 -04:00
UIEntity.h Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
UIEntityPyMethods.h Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
UIFrame.cpp Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
UIFrame.h Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
UIGrid.cpp hotfix: windows build, fresh docs 2025-07-10 16:34:46 -04:00
UIGrid.h Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
UIGridPoint.cpp Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
UIGridPoint.h Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
UISprite.cpp Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
UISprite.h Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
UITestScene.cpp Squashed commit of 53 Commits: [alpha_streamline_2] 2025-07-09 22:41:15 -04:00
UITestScene.h Refactor: remove "s" prefix from "sRender" method ( -> "render") Closes #44 2024-04-20 14:16:14 -04:00