From a6c4a7c9b581e7929acfeec1038f00f2952d0c6c Mon Sep 17 00:00:00 2001 From: thefiddler Date: Wed, 23 Jul 2014 21:15:16 +0200 Subject: [PATCH] [Mac] Only dispose context on UI thread --- Source/OpenTK/Platform/MacOS/CocoaContext.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/OpenTK/Platform/MacOS/CocoaContext.cs b/Source/OpenTK/Platform/MacOS/CocoaContext.cs index 89c17e4..58dcec2 100644 --- a/Source/OpenTK/Platform/MacOS/CocoaContext.cs +++ b/Source/OpenTK/Platform/MacOS/CocoaContext.cs @@ -333,6 +333,9 @@ namespace OpenTK Debug.Print("Disposing of Cocoa context."); + if (!NSApplication.IsUIThread) + return; + Cocoa.SendVoid(NSOpenGLContext, Selector.Get("clearCurrentContext")); Cocoa.SendVoid(Handle.Handle, Selector.Get("clearDrawable")); Cocoa.SendVoid(Handle.Handle, Selector.Get("release")); -- 2.7.4