mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-01-22 15:31:13 +00:00
[Mac] Explicitly retain/release CocoaWindowInfo instances
This commit is contained in:
parent
290cc91275
commit
1419c1e3a0
|
@ -38,6 +38,7 @@ namespace OpenTK.Platform.MacOS
|
|||
public static readonly IntPtr Init = Selector.Get("init");
|
||||
public static readonly IntPtr InitWithCoder = Selector.Get("initWithCoder:");
|
||||
public static readonly IntPtr Alloc = Selector.Get("alloc");
|
||||
public static readonly IntPtr Retain = Selector.Get("retain");
|
||||
public static readonly IntPtr Release = Selector.Get("release");
|
||||
public static readonly IntPtr Autorelease = Selector.Get("autorelease");
|
||||
|
||||
|
|
|
@ -1021,7 +1021,7 @@ namespace OpenTK.Platform.MacOS
|
|||
trackingArea = IntPtr.Zero;
|
||||
}
|
||||
|
||||
Cocoa.SendVoid(windowInfo.Handle, Selector.Release);
|
||||
windowInfo.Dispose();
|
||||
}
|
||||
|
||||
OnDisposed(EventArgs.Empty);
|
||||
|
|
|
@ -68,6 +68,7 @@ namespace OpenTK.Platform.MacOS
|
|||
{
|
||||
this.nsWindowRef = nsWindowRef;
|
||||
this.nsViewRef = nsViewRef;
|
||||
Cocoa.SendVoid(nsWindowRef, Selector.Retain);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -107,16 +108,22 @@ namespace OpenTK.Platform.MacOS
|
|||
|
||||
if (disposing)
|
||||
{
|
||||
|
||||
Cocoa.SendVoid(nsWindowRef, Selector.Release);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Print("CocoaWindowInfo:{0} leaked, did you forget to call Dispose()?", nsWindowRef);
|
||||
}
|
||||
|
||||
disposed = true;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
~CocoaWindowInfo()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue