From bbacbe3980e9e828d12ac46a2067fd821545c816 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 9 Nov 2010 23:53:28 +0000 Subject: [PATCH] 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 --- src/osx/core/evtloop_cf.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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(); } -- 2.45.2