mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-22 13:31:01 +00:00
[Mac] Correctly release mach port
The event tap is released automatically along with the mach port. Fixes crash on shutdown.
This commit is contained in:
parent
15f87c15a1
commit
bb882fe700
|
@ -1756,13 +1756,11 @@ namespace OpenTK.Platform.MacOS
|
|||
{
|
||||
if (manual)
|
||||
{
|
||||
if (MouseEventTap != IntPtr.Zero)
|
||||
{
|
||||
CF.CFRelease(MouseEventTap);
|
||||
MouseEventTap = IntPtr.Zero;
|
||||
}
|
||||
if (MouseEventTapSource != IntPtr.Zero)
|
||||
{
|
||||
// Note: releasing the mach port (tap source)
|
||||
// automatically releases the event tap.
|
||||
CF.RunLoopRemoveSource(RunLoop, MouseEventTapSource, CF.RunLoopModeDefault);
|
||||
CF.CFRelease(MouseEventTapSource);
|
||||
MouseEventTapSource = IntPtr.Zero;
|
||||
}
|
||||
|
|
|
@ -233,5 +233,11 @@ namespace OpenTK.Platform.MacOS.Carbon
|
|||
CFRunLoopRef rl,
|
||||
CFRunLoopSourceRef source,
|
||||
CFStringRef mode);
|
||||
|
||||
[DllImport(appServices, EntryPoint = "CFRunLoopRemoveSource")]
|
||||
internal static extern void RunLoopRemoveSource(
|
||||
CFRunLoopRef rl,
|
||||
CFRunLoopSourceRef source,
|
||||
CFStringRef mode);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue