From c02e959f7a70a5f45d59fec924e6db5eaed658a3 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Fri, 4 Aug 2017 18:39:44 +0200 Subject: [PATCH] Move early return out of the autorelease pool. --- src/OpenTK/Platform/MacOS/CocoaContext.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/OpenTK/Platform/MacOS/CocoaContext.cs b/src/OpenTK/Platform/MacOS/CocoaContext.cs index 67b68cb1..eaae8324 100644 --- a/src/OpenTK/Platform/MacOS/CocoaContext.cs +++ b/src/OpenTK/Platform/MacOS/CocoaContext.cs @@ -340,18 +340,16 @@ namespace OpenTK Debug.Print("Disposing of Cocoa context."); + if (!NSApplication.IsUIThread) + { + return; + } + using (var pool = new NSAutoreleasePool()) { - if (!NSApplication.IsUIThread) - { - return; - - } - if (IsCurrent) { Cocoa.SendVoid(NSOpenGLContext, Selector.Get("clearCurrentContext")); - } Cocoa.SendVoid(Handle.Handle, Selector.Get("clearDrawable"));