don't call SDL_DestroyRenderer
or SDL_Quit
until we get to gfx_sdl_destroy
#603
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.
soh testing pr: HarbourMasters/Shipwright#4172
in soh, quitting the game using the "Quit" option in the "Ship" menu was leading to garbage values in the config
this was happening because we call
SaveWindowToConfig()
in theContext
destructorlibultraship/src/Context.cpp
Lines 26 to 28 in 6b8a8d8
which makes calls to
Get
(Width
/Height
/PosX
/PosY
)libultraship/src/window/Window.cpp
Lines 48 to 60 in 6b8a8d8
which all call into
mWindowManagerApi->get_dimensions
libultraship/src/graphic/Fast3D/Fast3dWindow.cpp
Lines 156 to 161 in 6b8a8d8
which in SDL then calls
SDL_GL_GetDrawableSize
andSDL_GetWindowPosition
libultraship/src/graphic/Fast3D/gfx_sdl2.cpp
Lines 444 to 447 in 6b8a8d8
which gives us garbage if we've already called
so, instead of directly calling these in
gfx_sdl_close
, we can rely on the fact that these get called when we destructFast3dWindow
by callinggfx_destroy
libultraship/src/graphic/Fast3D/Fast3dWindow.cpp
Lines 35 to 38 in 6b8a8d8
which in SDL land is
gfx_sdl_destroy
libultraship/src/graphic/Fast3D/gfx_sdl2.cpp
Lines 606 to 611 in 6b8a8d8