[Mac] Only dispose context on UI thread
authorthefiddler <stapostol@gmail.com>
Wed, 23 Jul 2014 19:15:16 +0000 (21:15 +0200)
committerthefiddler <stapostol@gmail.com>
Wed, 23 Jul 2014 19:15:16 +0000 (21:15 +0200)
Source/OpenTK/Platform/MacOS/CocoaContext.cs

index 89c17e4..58dcec2 100644 (file)
@@ -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"));