mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-25 19:15:36 +00:00
Fix KeyNotFoundException in EventHandler routine.
This commit is contained in:
parent
9b3f1dc8ee
commit
14ea26c866
|
@ -217,8 +217,20 @@ namespace OpenTK.Platform.MacOS
|
||||||
|
|
||||||
protected static OSStatus EventHandler(IntPtr inCaller, IntPtr inEvent, IntPtr userData)
|
protected static OSStatus EventHandler(IntPtr inCaller, IntPtr inEvent, IntPtr userData)
|
||||||
{
|
{
|
||||||
EventInfo evt = new EventInfo(inEvent);
|
// bail out if the window passed in is not actually our window.
|
||||||
|
if (mWindows.ContainsKey(userData) == false)
|
||||||
|
return OSStatus.EventNotHandled;
|
||||||
|
|
||||||
WeakReference reference = mWindows[userData];
|
WeakReference reference = mWindows[userData];
|
||||||
|
|
||||||
|
// bail out if the CarbonGLNative window has been garbage collected.
|
||||||
|
if (reference.IsAlive == false)
|
||||||
|
{
|
||||||
|
mWindows.Remove(userData);
|
||||||
|
return OSStatus.EventNotHandled;
|
||||||
|
}
|
||||||
|
|
||||||
|
EventInfo evt = new EventInfo(inEvent);
|
||||||
CarbonGLNative window = (CarbonGLNative)reference.Target;
|
CarbonGLNative window = (CarbonGLNative)reference.Target;
|
||||||
|
|
||||||
//Debug.Print("Processing {0} event for {1}.", evt, window.window);
|
//Debug.Print("Processing {0} event for {1}.", evt, window.window);
|
||||||
|
|
Loading…
Reference in a new issue