From 2fefc6632d53a47c2f3046bfc872936e75fba0a1 Mon Sep 17 00:00:00 2001 From: Virgile Bello Date: Wed, 22 Jun 2016 17:45:41 +0900 Subject: [PATCH 1/2] GraphicsContextBase.ToString() was easily crashing or recursing infinitely --- Source/OpenTK/Graphics/GraphicsContextBase.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/OpenTK/Graphics/GraphicsContextBase.cs b/Source/OpenTK/Graphics/GraphicsContextBase.cs index d6537f53..a985f936 100644 --- a/Source/OpenTK/Graphics/GraphicsContextBase.cs +++ b/Source/OpenTK/Graphics/GraphicsContextBase.cs @@ -141,8 +141,8 @@ namespace OpenTK.Graphics public override string ToString() { - return string.Format("[{0}: IsCurrent={1}, IsDisposed={2}, VSync={3}, SwapInterval={4}, GraphicsMode={5}, ErrorChecking={6}, Implementation={7}, Context={8}]", - GetType().Name, IsCurrent, IsDisposed, VSync, SwapInterval, GraphicsMode, ErrorChecking, Implementation, Context); + return string.Format("[{0}: IsCurrent={1}, IsDisposed={2}, VSync={3}, SwapInterval={4}, GraphicsMode={5}, Context={6}]", + GetType().Name, IsCurrent, IsDisposed, VSync, SwapInterval, GraphicsMode, Context); } public override int GetHashCode() From d0006ce4faed073fa8a939259aaa81176ac3aa63 Mon Sep 17 00:00:00 2001 From: Virgile Bello Date: Wed, 22 Jun 2016 17:46:41 +0900 Subject: [PATCH 2/2] EglContext: directly use Handle when creating exception message --- Source/OpenTK/Platform/Egl/EglContext.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/OpenTK/Platform/Egl/EglContext.cs b/Source/OpenTK/Platform/Egl/EglContext.cs index 3a907ac8..b6cca8f9 100644 --- a/Source/OpenTK/Platform/Egl/EglContext.cs +++ b/Source/OpenTK/Platform/Egl/EglContext.cs @@ -117,7 +117,7 @@ namespace OpenTK.Platform.Egl { if (!Egl.SwapBuffers(WindowInfo.Display, WindowInfo.Surface)) { - throw new GraphicsContextException(string.Format("Failed to swap buffers for context {0} current. Error: {1}", this, Egl.GetError())); + throw new GraphicsContextException(string.Format("Failed to swap buffers for context {0} current. Error: {1}", Handle, Egl.GetError())); } } @@ -133,7 +133,7 @@ namespace OpenTK.Platform.Egl WindowInfo = (EglWindowInfo) window; if (!Egl.MakeCurrent(WindowInfo.Display, WindowInfo.Surface, WindowInfo.Surface, HandleAsEGLContext)) { - throw new GraphicsContextException(string.Format("Failed to make context {0} current. Error: {1}", this, Egl.GetError())); + throw new GraphicsContextException(string.Format("Failed to make context {0} current. Error: {1}", Handle, Egl.GetError())); } } else