From: thefiddler Date: Wed, 23 Jul 2014 07:21:28 +0000 (+0200) Subject: [Mac] Register platform resources for disposal X-Git-Tag: 2.0-0~105^2~18 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8f03b09dad2e755e368677b8570f776470e3823b;p=platform%2Fcore%2Fcsapi%2Fopentk.git [Mac] Register platform resources for disposal --- diff --git a/Source/OpenTK/Platform/MacOS/MacOSFactory.cs b/Source/OpenTK/Platform/MacOS/MacOSFactory.cs index 43e7bd7..091c115 100644 --- a/Source/OpenTK/Platform/MacOS/MacOSFactory.cs +++ b/Source/OpenTK/Platform/MacOS/MacOSFactory.cs @@ -49,22 +49,29 @@ namespace OpenTK.Platform.MacOS public override INativeWindow CreateNativeWindow(int x, int y, int width, int height, string title, GraphicsMode mode, GameWindowFlags options, DisplayDevice device) { - return new CocoaNativeWindow(x, y, width, height, title, mode, options, device); + INativeWindow window = new CocoaNativeWindow(x, y, width, height, title, mode, options, device); + RegisterResource(window); + return window; } public override IDisplayDeviceDriver CreateDisplayDeviceDriver() { + // Does not implement IDisposable return new QuartzDisplayDeviceDriver(); } public override IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags) { - return new CocoaContext(mode, window, shareContext, major, minor); + IGraphicsContext context = new CocoaContext(mode, window, shareContext, major, minor); + RegisterResource(context); + return context; } public override IGraphicsContext CreateGLContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags) { - return new CocoaContext(handle, window, shareContext, major, minor); + IGraphicsContext context = new CocoaContext(handle, window, shareContext, major, minor); + RegisterResource(context); + return context; } public override GraphicsContext.GetCurrentContextDelegate CreateGetCurrentGraphicsContext() @@ -98,12 +105,12 @@ namespace OpenTK.Platform.MacOS { if (!IsDisposed) { + base.Dispose(manual); + if (manual) { InputDriver.Dispose(); } - - base.Dispose(manual); } }