Fix most of the Objective-C GC problems by using the stronger CFRetain/CFRelease in wxObjcAutoRef.
Actually use wxObjcAutoRef for the wxNSViewNotificationObserver singleton to keep it from being finalized. Copyright 2008 Software 2000 Ltd. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@51576 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#import <Foundation/NSNotification.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#include "wx/cocoa/objc/NSView.h"
|
||||
#include "wx/cocoa/ObjcRef.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// globals
|
||||
@@ -221,5 +222,7 @@ WX_DECLARE_GET_OBJC_CLASS(wxNSViewNotificationObserver,NSObject)
|
||||
@end // implementation wxNSViewNotificationObserver
|
||||
WX_IMPLEMENT_GET_OBJC_CLASS(wxNSViewNotificationObserver,NSObject)
|
||||
|
||||
void *wxCocoaNSView::sm_cocoaObserver = [[WX_GET_OBJC_CLASS(wxNSViewNotificationObserver) alloc] init];
|
||||
|
||||
// New CF-retained observer (this should have been using wxObjcAutoRefFromAlloc to begin with)
|
||||
wxObjcAutoRefFromAlloc<wxNSViewNotificationObserver*> s_cocoaNSViewObserver([[WX_GET_OBJC_CLASS(wxNSViewNotificationObserver) alloc] init]);
|
||||
// For compatibility with old code
|
||||
id wxCocoaNSView::sm_cocoaObserver = s_cocoaNSViewObserver;
|
||||
|
||||
Reference in New Issue
Block a user