Don't dispose window twice on OSX.

This commit is contained in:
UnknownShadow200 2015-11-04 09:55:01 +11:00
parent d71efc2b7c
commit a8be2e4493
2 changed files with 2 additions and 22 deletions

View File

@ -110,7 +110,7 @@ namespace OpenTK.Platform.MacOS {
API.CheckReturn(err);
API.SetWindowTitle(windowRef, title);
window = new CarbonWindowInfo(windowRef, this, true);
window = new CarbonWindowInfo(windowRef, this);
SetLocation(r.X, r.Y);
SetSize(r.Width, r.Height);

View File

@ -34,16 +34,14 @@ namespace OpenTK.Platform.MacOS {
sealed class CarbonWindowInfo : IWindowInfo {
public IntPtr WindowRef;
bool ownHandle = false;
bool disposed = false;
internal bool goFullScreenHack = false;
internal bool goWindowedHack = false;
internal CarbonGLNative nativeWindow;
public CarbonWindowInfo( IntPtr windowRef, CarbonGLNative nativeWindow, bool ownHandle ) {
public CarbonWindowInfo( IntPtr windowRef, CarbonGLNative nativeWindow ) {
this.WindowRef = windowRef;
this.nativeWindow = nativeWindow;
this.ownHandle = ownHandle;
}
public override string ToString() {
@ -56,24 +54,6 @@ namespace OpenTK.Platform.MacOS {
}
public void Dispose() {
Dispose(true);
}
void Dispose(bool disposing) {
if (disposed)
return;
if (ownHandle) {
Debug.Print("Disposing window {0}.", WindowRef);
Carbon.API.DisposeWindow(this.WindowRef);
WindowRef = IntPtr.Zero;
}
disposed = true;
}
~CarbonWindowInfo() {
Dispose(false);
}
}
}