[macos] Allow passing null to CGLContext.CurrentContext. Fixes #53273
This commit is contained in:
Родитель
8b376efa4b
Коммит
f17c63ef16
|
@ -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;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче