Make it crash less.

Time to refactor the code to take into account that the application can exit D3D fullscreen.