X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/065e208ec09e3d08d51d9604497f92f53c210f93..c12822fec7f87e7734cabbfcf23b99685fc371ce:/src/cocoa/NSControl.mm?ds=sidebyside

diff --git a/src/cocoa/NSControl.mm b/src/cocoa/NSControl.mm
index ab10708d20..2a02e2ddd3 100644
--- a/src/cocoa/NSControl.mm
+++ b/src/cocoa/NSControl.mm
@@ -4,7 +4,7 @@
 // Author:      David Elliott
 // Modified by:
 // Created:     2003/02/15
-// RCS-ID:      $Id: 
+// RCS-ID:      $Id$
 // Copyright:   (c) 2003 David Elliott
 // Licence:     wxWidgets licence
 /////////////////////////////////////////////////////////////////////////////
@@ -22,6 +22,8 @@
     #include "wx/log.h"
 #endif // WX_PRECOMP
 
+#include "wx/cocoa/objc/objc_uniquifying.h"
+#include "wx/cocoa/ObjcRef.h"
 #include "wx/cocoa/NSControl.h"
 
 #import <Foundation/NSObject.h>
@@ -35,6 +37,7 @@
 
 - (void)wxNSControlAction: (id)sender;
 @end //interface wxNSControlTarget
+WX_DECLARE_GET_OBJC_CLASS(wxNSControlTarget,NSObject)
 
 @implementation wxNSControlTarget : NSObject
 
@@ -47,11 +50,15 @@
 }
 
 @end //implementation wxNSControlTarget
+WX_IMPLEMENT_GET_OBJC_CLASS(wxNSControlTarget,NSObject)
 
 // ============================================================================
 // wxNSControl
 // ============================================================================
 WX_IMPLEMENT_OBJC_INTERFACE(NSControl)
 
-struct objc_object *wxCocoaNSControl::sm_cocoaTarget = [[wxNSControlTarget alloc] init];
+// New CF-retained observer (this should have been using wxObjcAutoRefFromAlloc to begin with)
+wxObjcAutoRefFromAlloc<wxNSControlTarget*> s_cocoaNSControlTarget = [[WX_GET_OBJC_CLASS(wxNSControlTarget) alloc] init];
+// For compatibility with old code
+struct objc_object *wxCocoaNSControl::sm_cocoaTarget = s_cocoaNSControlTarget;