From: Vadim Zeitlin Date: Tue, 9 Nov 2010 23:53:28 +0000 (+0000) Subject: Fix crash in wxCFEventLoop::AddSourceForFD(). X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/bbacbe3980e9e828d12ac46a2067fd821545c816?ds=inline Fix crash in wxCFEventLoop::AddSourceForFD(). Don't reset CFFileDescriptorRef before passing it to CFFileDescriptorCreateRunLoopSource(), this resulted in a crash inside this function. Closes #11542. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66075 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/osx/core/evtloop_cf.cpp b/src/osx/core/evtloop_cf.cpp index 38d3233b71..f151cb5684 100644 --- a/src/osx/core/evtloop_cf.cpp +++ b/src/osx/core/evtloop_cf.cpp @@ -107,8 +107,6 @@ wxCFEventLoop::AddSourceForFD(int fd, if ( !cffd ) return NULL; - source->SetFileDescriptor(cffd.release()); - wxCFRef cfsrc(CFFileDescriptorCreateRunLoopSource(kCFAllocatorDefault, cffd, 0)); if ( !cfsrc ) @@ -117,6 +115,8 @@ wxCFEventLoop::AddSourceForFD(int fd, CFRunLoopRef cfloop = CFGetCurrentRunLoop(); CFRunLoopAddSource(cfloop, cfsrc, kCFRunLoopDefaultMode); + source->SetFileDescriptor(cffd.release()); + return source.release(); }