#include "wx/module.h"
#include "wx/cocoa/ObjcPose.h"
+#include "wx/cocoa/autorelease.h"
#if wxUSE_WX_RESOURCES
# include "wx/resource.h"
@end // wxPoserNSApplication
WX_IMPLEMENT_POSER(wxPoserNSApplication);
-class wxAutoNSAutoreleasePool
-{
-public:
- wxAutoNSAutoreleasePool()
- {
- m_pool = [[NSAutoreleasePool alloc] init];
- }
- ~wxAutoNSAutoreleasePool()
- {
- [m_pool release];
- }
-protected:
- NSAutoreleasePool *m_pool;
-};
-
// ============================================================================
// functions
// ============================================================================
#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler)
BEGIN_EVENT_TABLE(wxApp, wxEvtHandler)
+ EVT_IDLE(wxAppBase::OnIdle)
// EVT_END_SESSION(wxApp::OnEndSession)
// EVT_QUERY_END_SESSION(wxApp::OnQueryEndSession)
END_EVENT_TABLE()
wxApp::wxApp()
{
m_topWindow = NULL;
- wxTheApp = this;
m_isIdle = true;
#if WXWIN_COMPATIBILITY_2_2
void wxApp::CocoaInstallIdleHandler()
{
+ // If we're supposed to be stopping, don't add more idle events
+ if(![m_cocoaApp isRunning])
+ return;
wxLogDebug("wxApp::CocoaInstallIdleHandler");
m_isIdle = false;
// Call doIdle for EVERYTHING dammit
bool wxApp::CallOnInit()
{
- wxAutoNSAutoreleasePool pool;
+// wxAutoNSAutoreleasePool pool;
return OnInit();
}
if(!m_isIdle)
[[ NSRunLoop currentRunLoop ] cancelPerformSelector:@selector(doIdle:) target:m_cocoaApp argument:NULL];
#endif
- [m_cocoaApp terminate: m_cocoaApp];
+ [m_cocoaApp stop: m_cocoaApp];
}
// Is a message/event pending?