Provide NSAutoreleasePool instances during initialization
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21608 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -65,6 +65,8 @@ public:
|
|||||||
|
|
||||||
virtual bool Initialize(int& argc, wxChar **argv);
|
virtual bool Initialize(int& argc, wxChar **argv);
|
||||||
virtual void CleanUp();
|
virtual void CleanUp();
|
||||||
|
virtual bool CallOnInit();
|
||||||
|
|
||||||
|
|
||||||
virtual bool OnInit();
|
virtual bool OnInit();
|
||||||
virtual bool OnInitGui();
|
virtual bool OnInitGui();
|
||||||
|
@@ -39,6 +39,7 @@
|
|||||||
#import <AppKit/NSApplication.h>
|
#import <AppKit/NSApplication.h>
|
||||||
#import <Foundation/NSRunLoop.h>
|
#import <Foundation/NSRunLoop.h>
|
||||||
#import <Foundation/NSArray.h>
|
#import <Foundation/NSArray.h>
|
||||||
|
#import <Foundation/NSAutoreleasePool.h>
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// globals
|
// globals
|
||||||
@@ -107,6 +108,21 @@ wxPoseAsInitializer *wxPoseAsInitializer::sm_first = NULL;
|
|||||||
@end // wxPoserNSApplication
|
@end // wxPoserNSApplication
|
||||||
WX_IMPLEMENT_POSER(wxPoserNSApplication);
|
WX_IMPLEMENT_POSER(wxPoserNSApplication);
|
||||||
|
|
||||||
|
class wxAutoNSAutoreleasePool
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxAutoNSAutoreleasePool()
|
||||||
|
{
|
||||||
|
m_pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
}
|
||||||
|
~wxAutoNSAutoreleasePool()
|
||||||
|
{
|
||||||
|
[m_pool release];
|
||||||
|
}
|
||||||
|
protected:
|
||||||
|
NSAutoreleasePool *m_pool;
|
||||||
|
};
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// functions
|
// functions
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -141,6 +157,7 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
bool wxApp::Initialize(int& argc, wxChar **argv)
|
bool wxApp::Initialize(int& argc, wxChar **argv)
|
||||||
{
|
{
|
||||||
|
wxAutoNSAutoreleasePool pool;
|
||||||
// Mac OS X passes a process serial number command line argument when
|
// Mac OS X passes a process serial number command line argument when
|
||||||
// the application is launched from the Finder. This argument must be
|
// the application is launched from the Finder. This argument must be
|
||||||
// removed from the command line arguments before being handled by the
|
// removed from the command line arguments before being handled by the
|
||||||
@@ -199,6 +216,7 @@ void wxApp::CocoaInstallIdleHandler()
|
|||||||
|
|
||||||
bool wxApp::OnInitGui()
|
bool wxApp::OnInitGui()
|
||||||
{
|
{
|
||||||
|
wxAutoNSAutoreleasePool pool;
|
||||||
if(!wxAppBase::OnInitGui())
|
if(!wxAppBase::OnInitGui())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@@ -214,6 +232,12 @@ bool wxApp::OnInitGui()
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxApp::CallOnInit()
|
||||||
|
{
|
||||||
|
wxAutoNSAutoreleasePool pool;
|
||||||
|
return OnInit();
|
||||||
|
}
|
||||||
|
|
||||||
bool wxApp::OnInit()
|
bool wxApp::OnInit()
|
||||||
{
|
{
|
||||||
if(!wxAppBase::OnInit())
|
if(!wxAppBase::OnInit())
|
||||||
|
Reference in New Issue
Block a user