Window is set to null before UnloadContent on the WindowsDX platform
Opened this issue · 1 comments
Prerequisites
- I have verified this issue is not present in the
develop
branch - I have searched open and closed issues to ensure it has not already been reported.
MonoGame Version
MonoGame 3.8.1.303
Which MonoGame platform are you using?
MonoGame Windows Desktop Application (mgwindowsdx)
Operating System
Windows
Description
On the DesktopGL platform, it's possible to access the game window during UnloadContent
. This makes it possible to save the window size and position for example. The window is only disposed during the Platform.Dispose:
MonoGame/MonoGame.Framework/Platform/SDL/SDLGamePlatform.cs
Lines 329 to 339 in a91dcc7
On the WindowsDX platform, the Windows is disposed earlier in Platform.Exit:
MonoGame/MonoGame.Framework/Platform/Windows/WinFormsGamePlatform.cs
Lines 71 to 77 in a91dcc7
Steps to Reproduce
Access the game window during UnloadContent
.
Minimal Example Repo
No response
Expected Behavior
The game window shouldn't be disposed before UnloadContent
is done.
Resulting Behavior
The game window position and size can't be accessed.
Files
No response
The game window position and size can't be accessed.... The game window shouldn't be disposed before UnloadContent is done.
UnloadContent()
Is the place to dispose any manually allocated resources previously allocated via native Malloc
calls.
Why would you expect the window
to exist during UnloadContent()
?
Store the information at load and modify.