]> git.saurik.com Git - wxWidgets.git/blobdiff - src/cocoa/NSMenu.mm
Large image-loading speedup and small attribute-loading speedup
[wxWidgets.git] / src / cocoa / NSMenu.mm
index 635b2ee96eef23eca7cc52aa3974ddfb44364e3b..c5a55f9c3a4a6bd6715c33310f2148fbf66df78b 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     2002/12/09
 // RCS-ID:      $Id$
 // Copyright:   (c) 2002 David Elliott
-// Licence:     wxWidgets licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #include "wx/wxprec.h"
@@ -15,6 +15,7 @@
     #include "wx/log.h"
 #endif // WX_PRECOMP
 
+#include "wx/cocoa/ObjcRef.h"
 #include "wx/cocoa/NSMenu.h"
 
 #import <Foundation/NSNotification.h>
@@ -97,7 +98,10 @@ WX_IMPLEMENT_GET_OBJC_CLASS(wxNSMenuNotificationObserver,NSObject)
 // ========================================================================
 WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSMenu)
 
-struct objc_object *wxCocoaNSMenu::sm_cocoaObserver = [[WX_GET_OBJC_CLASS(wxNSMenuNotificationObserver) alloc] init];
+// New CF-retained observer (this should have been using wxObjcAutoRefFromAlloc to begin with)
+static wxObjcAutoRefFromAlloc<wxNSMenuNotificationObserver*> s_cocoaNSMenuObserver([[WX_GET_OBJC_CLASS(wxNSMenuNotificationObserver) alloc] init]);
+// For compatibility with old code
+struct objc_object *wxCocoaNSMenu::sm_cocoaObserver = s_cocoaNSMenuObserver;
 
 void wxCocoaNSMenu::AssociateNSMenu(WX_NSMenu cocoaNSMenu, unsigned int flags)
 {