From 623cfa7e9d16d9f2ff28d9af707f6eb4b5d3423c Mon Sep 17 00:00:00 2001 From: Virgile Bello Date: Fri, 20 May 2016 12:53:21 +0900 Subject: [PATCH] Egl: Unset context when calling MakeCurrent(null) --- Source/OpenTK/Platform/Egl/EglContext.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Source/OpenTK/Platform/Egl/EglContext.cs b/Source/OpenTK/Platform/Egl/EglContext.cs index 18b33717..9312ad81 100644 --- a/Source/OpenTK/Platform/Egl/EglContext.cs +++ b/Source/OpenTK/Platform/Egl/EglContext.cs @@ -126,9 +126,16 @@ namespace OpenTK.Platform.Egl // trying to make the EglContext current on a non-EGL window will do, // nothing (the EglContext will remain current on the previous EGL window // or the window it was constructed on (which may not be EGL)). - if (window is EglWindowInfo) - WindowInfo = (EglWindowInfo)window; - Egl.MakeCurrent(WindowInfo.Display, WindowInfo.Surface, WindowInfo.Surface, HandleAsEGLContext); + if (window != null) + { + if (window is EglWindowInfo) + WindowInfo = (EglWindowInfo) window; + Egl.MakeCurrent(WindowInfo.Display, WindowInfo.Surface, WindowInfo.Surface, HandleAsEGLContext); + } + else + { + Egl.MakeCurrent(WindowInfo.Display, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); + } } public override bool IsCurrent