[macos] Allow passing null to CGLContext.CurrentContext. Fixes #53273

This commit is contained in:
Timothy Risi 2017-03-16 11:34:53 -08:00 коммит произвёл GitHub
Родитель 8b376efa4b
Коммит f17c63ef16
2 изменённых файлов: 17 добавлений и 1 удалений

Просмотреть файл

@ -117,7 +117,7 @@ namespace XamCore.OpenGL {
set {
CGLErrorCode retValue = CGLSetCurrentContext (value.Handle);
CGLErrorCode retValue = CGLSetCurrentContext (value?.Handle ?? IntPtr.Zero);
if (retValue != CGLErrorCode.NoError)
throw new Exception ("Error setting the Current Context");
}

Просмотреть файл

@ -0,0 +1,16 @@
using System;
using NUnit.Framework;
using OpenGL;
namespace Xamarin.Mac.Tests {
[TestFixture]
public class CGLContextTests {
[Test]
public void CurrentContextAllowsNull ()
{
Assert.DoesNotThrow (() => {
CGLContext.CurrentContext = null;
});
}
}
}