From f799530575827413da7485080898219deabf1bc8 Mon Sep 17 00:00:00 2001 From: thefiddler Date: Wed, 23 Jul 2014 23:22:00 +0200 Subject: [PATCH] [Mac] Do not use autorelease pool Avoids a potential crash on shutdown. --- .../OpenTK/Platform/MacOS/Cocoa/NSApplication.cs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/Source/OpenTK/Platform/MacOS/Cocoa/NSApplication.cs b/Source/OpenTK/Platform/MacOS/Cocoa/NSApplication.cs index bdab0212..6011f05e 100644 --- a/Source/OpenTK/Platform/MacOS/Cocoa/NSApplication.cs +++ b/Source/OpenTK/Platform/MacOS/Cocoa/NSApplication.cs @@ -67,22 +67,17 @@ namespace OpenTK.Platform.MacOS Cocoa.SendVoid(Handle, Selector.Get("activateIgnoringOtherApps:"), true); // Create the menu bar - var menubar = Cocoa.SendIntPtr(Cocoa.SendIntPtr(Class.Get("NSMenu"), Selector.Alloc), - Selector.Autorelease); - - var menuItem = Cocoa.SendIntPtr(Cocoa.SendIntPtr(Class.Get("NSMenuItem"), Selector.Alloc), - Selector.Autorelease); + var menubar = Cocoa.SendIntPtr(Class.Get("NSMenu"), Selector.Alloc); + var menuItem = Cocoa.SendIntPtr(Class.Get("NSMenuItem"), Selector.Alloc); // Add menu item to bar, and bar to application Cocoa.SendIntPtr(menubar, Selector.Get("addItem:"), menuItem); Cocoa.SendIntPtr(Handle, Selector.Get("setMainMenu:"), menubar); // Add a "Quit" menu item and bind the button. - var appMenu = Cocoa.SendIntPtr(Cocoa.SendIntPtr(Class.Get("NSMenu"), Selector.Alloc), - Selector.Autorelease); - var quitMenuItem = Cocoa.SendIntPtr(Cocoa.SendIntPtr(Cocoa.SendIntPtr(Class.Get("NSMenuItem"), Selector.Alloc), - Selector.Get("initWithTitle:action:keyEquivalent:"), Cocoa.ToNSString("Quit"), selQuit, Cocoa.ToNSString("q")), - Selector.Autorelease); + var appMenu = Cocoa.SendIntPtr(Class.Get("NSMenu"), Selector.Alloc); + var quitMenuItem = Cocoa.SendIntPtr(Cocoa.SendIntPtr(Class.Get("NSMenuItem"), Selector.Alloc), + Selector.Get("initWithTitle:action:keyEquivalent:"), Cocoa.ToNSString("Quit"), selQuit, Cocoa.ToNSString("q")); Cocoa.SendIntPtr(appMenu, Selector.Get("addItem:"), quitMenuItem); Cocoa.SendIntPtr(menuItem, Selector.Get("setSubmenu:"), appMenu);