mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-02-02 09:11:10 +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 Init = Selector.Get("init");
|
||||||
public static readonly IntPtr InitWithCoder = Selector.Get("initWithCoder:");
|
public static readonly IntPtr InitWithCoder = Selector.Get("initWithCoder:");
|
||||||
public static readonly IntPtr Alloc = Selector.Get("alloc");
|
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 Release = Selector.Get("release");
|
||||||
public static readonly IntPtr Autorelease = Selector.Get("autorelease");
|
public static readonly IntPtr Autorelease = Selector.Get("autorelease");
|
||||||
|
|
||||||
|
|
|
@ -1021,7 +1021,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
trackingArea = IntPtr.Zero;
|
trackingArea = IntPtr.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cocoa.SendVoid(windowInfo.Handle, Selector.Release);
|
windowInfo.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
OnDisposed(EventArgs.Empty);
|
OnDisposed(EventArgs.Empty);
|
||||||
|
|
|
@ -68,6 +68,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
{
|
{
|
||||||
this.nsWindowRef = nsWindowRef;
|
this.nsWindowRef = nsWindowRef;
|
||||||
this.nsViewRef = nsViewRef;
|
this.nsViewRef = nsViewRef;
|
||||||
|
Cocoa.SendVoid(nsWindowRef, Selector.Retain);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -107,16 +108,22 @@ namespace OpenTK.Platform.MacOS
|
||||||
|
|
||||||
if (disposing)
|
if (disposing)
|
||||||
{
|
{
|
||||||
|
Cocoa.SendVoid(nsWindowRef, Selector.Release);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Print("CocoaWindowInfo:{0} leaked, did you forget to call Dispose()?", nsWindowRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
disposed = true;
|
disposed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
~CocoaWindowInfo()
|
~CocoaWindowInfo()
|
||||||
{
|
{
|
||||||
Dispose(false);
|
Dispose(false);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue