adding proper removal of observer for stacked event loops, using cfrunloop for console on osx as well

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63698 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2010-03-17 08:05:04 +00:00
parent 80eee8378f
commit 9aee121225
4 changed files with 13 additions and 7 deletions

View File

@@ -186,16 +186,19 @@ wxCFEventLoop::wxCFEventLoop()
{
m_shouldExit = false;
m_runLoop = CFGetCurrentRunLoop();
CFRunLoopObserverContext ctxt;
bzero( &ctxt, sizeof(ctxt) );
ctxt.info = this;
m_runLoopObserver = CFRunLoopObserverCreate( kCFAllocatorDefault, kCFRunLoopBeforeTimers | kCFRunLoopBeforeWaiting , true /* repeats */, 0,
wxObserverCallBack, &ctxt );
CFRunLoopAddObserver(CFGetCurrentRunLoop(), m_runLoopObserver, kCFRunLoopDefaultMode);
CFRunLoopAddObserver(m_runLoop, m_runLoopObserver, kCFRunLoopDefaultMode);
}
wxCFEventLoop::~wxCFEventLoop()
{
CFRunLoopRemoveObserver(m_runLoop, m_runLoopObserver, kCFRunLoopDefaultMode);
}