-
Notifications
You must be signed in to change notification settings - Fork 463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bugfix] Move Heaps_Free
after DeinitOTR
in SDL_main
#3279
[Bugfix] Move Heaps_Free
after DeinitOTR
in SDL_main
#3279
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good enough to me 👍
I wonder if maybe we should also set system globals to NULL
like gPlayState
, but I don't know what all is managed by the system heap and that doesn't need to happen in this PR.
|
It doesn't right now, the problem was exposed when DeinitOTR was calling a destruct function in Anchor using the |
Is |
As a matter of fact, it isn't. |
Knowing this now, this might also be related to my issues with certain hooks not getting called in the process of closing SoH in the middle of a game. |
Heck, that might even be why Proxy felt the need to call the Anchor deinit function in |
I agree this can still be merged since it doesn't break anything and will continue to not break anything after a better fix is found. |
Should |
I could see doing that just for consistency's sake. |
Does |
Doesn't look like it. It only uses defines for sizes, and they're assigned to variables in heaps.c, and moving it to the top of Main() didn't prevent it from running. |
…s_Alloc` before and outside of `Main`.
d0e630d
to
7760756
Compare
Anchor was having some issues with accessing a non-null, garbage
gPlayState
fromDeinitOTR
as part of cleanup when closing while the game was running, causing a crash on closing. This was caused byHeaps_Free
inMain
deallocating the memory forgPlayState
without making its pointer null. This PR movesHeaps_Free
afterDeinitOTR
inSDL_main
so all closing/cleanup operations can be done without worrying about non-null garbage pointers/references.I took this approach instead of moving
DeinitOTR
insideMain
beforeHeaps_Free
as I figured there was probably a reason Deinit wasn't added inside Main in the first place, and this provides a better model for adding anything else that we might need in the future beforeHeaps_Free
.Build Artifacts