[Mac] Do not use Autorelease pool
authorthefiddler <stapostol@gmail.com>
Tue, 22 Jul 2014 14:29:52 +0000 (16:29 +0200)
committerthefiddler <stapostol@gmail.com>
Tue, 22 Jul 2014 14:29:52 +0000 (16:29 +0200)
Source/OpenTK/Platform/MacOS/Cocoa/Cocoa.cs

index cc2d98d..8357de3 100644 (file)
@@ -209,14 +209,13 @@ namespace OpenTK.Platform.MacOS
 
                 fixed (byte* pBytes = b)
                 {
-                    IntPtr nsData = Cocoa.SendIntPtr(Cocoa.SendIntPtr(Cocoa.SendIntPtr(Class.Get("NSData"), Selector.Alloc),
-                        Selector.Get("initWithBytes:length:"), (IntPtr)pBytes, b.Length),
-                        Selector.Autorelease);
+                    IntPtr nsData = Cocoa.SendIntPtr(Cocoa.SendIntPtr(Class.Get("NSData"), Selector.Alloc),
+                        Selector.Get("initWithBytes:length:"), (IntPtr)pBytes, b.Length);
 
-                    IntPtr nsImage = Cocoa.SendIntPtr(Cocoa.SendIntPtr(Cocoa.SendIntPtr(Class.Get("NSImage"), Selector.Alloc), 
-                        Selector.Get("initWithData:"), nsData),
-                        Selector.Autorelease);
+                    IntPtr nsImage = Cocoa.SendIntPtr(Cocoa.SendIntPtr(Class.Get("NSImage"), Selector.Alloc), 
+                        Selector.Get("initWithData:"), nsData);
 
+                    Cocoa.SendVoid(nsData, Selector.Release);
                     return nsImage;
                 }
             }