[Mac] Don't let exceptions escape to unmanaged code

This commit is contained in:
thefiddler 2014-01-05 04:20:51 +01:00
parent 892d129e54
commit 4c7f6a92a7

View file

@ -143,6 +143,8 @@ namespace OpenTK.Platform.MacOS
}
void DeviceAdded(IntPtr context, IOReturn res, IntPtr sender, IOHIDDeviceRef device)
{
try
{
bool recognized = false;
@ -181,8 +183,15 @@ namespace OpenTK.Platform.MacOS
}
}
}
catch (Exception e)
{
Debug.Print("[Mac] Exception in managed callback: {0}", e);
}
}
void DeviceRemoved(IntPtr context, IOReturn res, IntPtr sender, IOHIDDeviceRef device)
{
try
{
bool recognized = false;
@ -213,8 +222,15 @@ namespace OpenTK.Platform.MacOS
NativeMethods.IOHIDDeviceUnscheduleFromRunLoop(device, RunLoop, InputLoopMode);
}
}
catch (Exception e)
{
Debug.Print("[Mac] Exception in managed callback: {0}", e);
}
}
void DeviceValueReceived(IntPtr context, IOReturn res, IntPtr sender, IOHIDValueRef val)
{
try
{
if (disposed)
{
@ -243,6 +259,11 @@ namespace OpenTK.Platform.MacOS
//Debug.Print ("Device {0:x} not found in list of keyboards or mice", sender);
}
}
catch (Exception e)
{
Debug.Print("[Mac] Exception in managed callback: {0}", e);
}
}
#region Mouse