rds1983 / Myra

UI Library for MonoGame, FNA and Stride
MIT License
704 stars 93 forks source link

There is no way to tell Myra.PlatformAgnostic that the game is disposed leading to crashes and graphical glitches. #322

Closed KatPurpy closed 3 years ago

KatPurpy commented 3 years ago

If you create a Myra.PlatformAgnostic Desktop, the custom Platform's CreateTexture will be called, that's the expected behaviour. But when the game instance is disposed, the texture reference stays the same but the texture is disposed. Due to a design flaw it is impossible to tell Myra that the game is disposed and the resources must be recreated, that leads to crashes and other glitches that happen when GPU accesses a disposed texture.

rds1983 commented 3 years ago

I've added public static method MyraEnvironment.Reset(). It disposes all default assets and the stylesheet. All widgets created after calling it would use the new instances of the default stylesheet/texture.