/////////////////////////////////////////////////////////////////////////////
-// Name: cocoa/NSMenu.mm
+// Name: src/cocoa/NSMenu.mm
// Purpose: wxCocoaNSMenu implementation
// Author: David Elliott
// Modified by:
// Created: 2002/12/09
-// RCS-ID: $Id$
// Copyright: (c) 2002 David Elliott
-// Licence: wxWidgets licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
#include "wx/log.h"
#endif // WX_PRECOMP
+#include "wx/cocoa/ObjcRef.h"
#include "wx/cocoa/NSMenu.h"
#import <Foundation/NSNotification.h>
// ========================================================================
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)
{