diff --git a/OpenRA.FileFormats/Graphics/IGraphicsDevice.cs b/OpenRA.FileFormats/Graphics/IGraphicsDevice.cs index 564a143825..9be4681fc8 100755 --- a/OpenRA.FileFormats/Graphics/IGraphicsDevice.cs +++ b/OpenRA.FileFormats/Graphics/IGraphicsDevice.cs @@ -58,6 +58,8 @@ namespace OpenRA.FileFormats.Graphics void DisableDepthBuffer(); void SetBlendMode(BlendMode mode); + + void Quit(); } public interface IVertexBuffer diff --git a/OpenRA.Game/Support/Program.cs b/OpenRA.Game/Support/Program.cs index d73aa72a8e..46af602df8 100644 --- a/OpenRA.Game/Support/Program.cs +++ b/OpenRA.Game/Support/Program.cs @@ -50,8 +50,11 @@ namespace OpenRA Log.Write("exception", "{0}", rpt); Console.Error.WriteLine(rpt); - if (Game.Settings.Debug.ShowFatalErrorDialog) + if (Game.Settings.Debug.ShowFatalErrorDialog && !Game.Settings.Server.Dedicated) + { + Game.Renderer.Device.Quit(); FatalErrorDialog.Show(); + } } static StringBuilder BuildExceptionReport(Exception e) diff --git a/OpenRA.Renderer.Cg/GraphicsDevice.cs b/OpenRA.Renderer.Cg/GraphicsDevice.cs index 0ec830f7a1..a6ede53884 100755 --- a/OpenRA.Renderer.Cg/GraphicsDevice.cs +++ b/OpenRA.Renderer.Cg/GraphicsDevice.cs @@ -61,6 +61,12 @@ namespace OpenRA.Renderer.Cg FragmentProfile = CgGl.cgGLGetLatestProfile(CgGl.CG_GL_FRAGMENT); } + public override void Quit() + { + Tao.Cg.Cg.cgDestroyContext(Context); + base.Quit(); + } + public override IShader CreateShader(string name) { return new Shader(this, name); } } } diff --git a/OpenRA.Renderer.Null/NullGraphicsDevice.cs b/OpenRA.Renderer.Null/NullGraphicsDevice.cs index e58e5c10f1..b8821266e1 100644 --- a/OpenRA.Renderer.Null/NullGraphicsDevice.cs +++ b/OpenRA.Renderer.Null/NullGraphicsDevice.cs @@ -35,6 +35,8 @@ namespace OpenRA.Renderer.Null WindowSize = size; } + public void Quit() { } + public void EnableScissor(int left, int top, int width, int height) { } public void DisableScissor() { } diff --git a/OpenRA.Renderer.SdlCommon/SdlGraphics.cs b/OpenRA.Renderer.SdlCommon/SdlGraphics.cs index 4a48be0f5f..f8ab2ecde7 100644 --- a/OpenRA.Renderer.SdlCommon/SdlGraphics.cs +++ b/OpenRA.Renderer.SdlCommon/SdlGraphics.cs @@ -106,6 +106,11 @@ namespace OpenRA.Renderer.SdlCommon return surf; } + public virtual void Quit() + { + Sdl.SDL_Quit(); + } + int ModeFromPrimitiveType(PrimitiveType pt) { switch (pt)