More GC fixes.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@51795 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
#include "wx/log.h"
|
#include "wx/log.h"
|
||||||
#endif // WX_PRECOMP
|
#endif // WX_PRECOMP
|
||||||
|
|
||||||
|
#include "wx/cocoa/ObjcRef.h"
|
||||||
#include "wx/cocoa/NSMenu.h"
|
#include "wx/cocoa/NSMenu.h"
|
||||||
|
|
||||||
#import <Foundation/NSNotification.h>
|
#import <Foundation/NSNotification.h>
|
||||||
@@ -97,7 +98,10 @@ WX_IMPLEMENT_GET_OBJC_CLASS(wxNSMenuNotificationObserver,NSObject)
|
|||||||
// ========================================================================
|
// ========================================================================
|
||||||
WX_IMPLEMENT_OBJC_INTERFACE_HASHMAP(NSMenu)
|
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)
|
void wxCocoaNSMenu::AssociateNSMenu(WX_NSMenu cocoaNSMenu, unsigned int flags)
|
||||||
{
|
{
|
||||||
|
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "wx/cocoa/string.h"
|
#include "wx/cocoa/string.h"
|
||||||
#include "wx/cocoa/autorelease.h"
|
#include "wx/cocoa/autorelease.h"
|
||||||
|
#include "wx/cocoa/ObjcRef.h"
|
||||||
#include "wx/cocoa/NSTableDataSource.h"
|
#include "wx/cocoa/NSTableDataSource.h"
|
||||||
|
|
||||||
#import <Foundation/NSArray.h>
|
#import <Foundation/NSArray.h>
|
||||||
@@ -83,7 +84,7 @@ The listbox contents are sorted in alphabetical order.
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Provide the data
|
// Provide the data
|
||||||
m_cocoaItems = [[NSMutableArray arrayWithCapacity:n] retain];
|
m_cocoaItems = wxGCSafeRetain([NSMutableArray arrayWithCapacity:n]);
|
||||||
for(int i=0; i < n; i++)
|
for(int i=0; i < n; i++)
|
||||||
{
|
{
|
||||||
[m_cocoaItems addObject: wxNSStringWithWxString(choices[i])];
|
[m_cocoaItems addObject: wxNSStringWithWxString(choices[i])];
|
||||||
@@ -129,7 +130,8 @@ wxListBox::~wxListBox()
|
|||||||
{
|
{
|
||||||
[GetNSTableView() setDataSource: nil];
|
[GetNSTableView() setDataSource: nil];
|
||||||
[m_cocoaDataSource release];
|
[m_cocoaDataSource release];
|
||||||
[m_cocoaItems release];
|
wxGCSafeRelease(m_cocoaItems);
|
||||||
|
m_cocoaItems = nil;
|
||||||
DisassociateNSTableView(GetNSTableView());
|
DisassociateNSTableView(GetNSTableView());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user