diff options
author | Benoit Foucher <benoit@zeroc.com> | 2018-02-27 11:30:32 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2018-02-27 11:30:32 +0100 |
commit | 39f3974e52572f33ece6a167993827987210f67e (patch) | |
tree | 245b792b70ace2e55a39dd304f72349266c2a77b /cpp/src/Ice/Selector.cpp | |
parent | Added instructions for make clean (diff) | |
download | ice-39f3974e52572f33ece6a167993827987210f67e.tar.bz2 ice-39f3974e52572f33ece6a167993827987210f67e.tar.xz ice-39f3974e52572f33ece6a167993827987210f67e.zip |
Fixed UWP connection memory leak (ICE-8686)
Diffstat (limited to 'cpp/src/Ice/Selector.cpp')
-rw-r--r-- | cpp/src/Ice/Selector.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/cpp/src/Ice/Selector.cpp b/cpp/src/Ice/Selector.cpp index b926ebc4419..e0c228ffcf9 100644 --- a/cpp/src/Ice/Selector.cpp +++ b/cpp/src/Ice/Selector.cpp @@ -72,6 +72,7 @@ Selector::initialize(EventHandler* handler) { return; } + #ifdef ICE_USE_IOCP HANDLE socket = reinterpret_cast<HANDLE>(handler->getNativeInfo()->fd()); if(CreateIoCompletionPort(socket, _handle, reinterpret_cast<ULONG_PTR>(handler), 0) == ICE_NULLPTR) @@ -114,6 +115,14 @@ Selector::update(EventHandler* handler, SocketOperation remove, SocketOperation void Selector::finish(IceInternal::EventHandler* handler) { +#ifdef ICE_OS_UWP + // If async operations are no longer pending, clear the completion handler to break + // the cyclic reference count. + if(!handler->_started) + { + handler->getNativeInfo()->setCompletedHandler(nullptr); + } +#endif handler->_registered = SocketOperationNone; handler->_finish = false; // Ensures that finished() is only called once on the event handler. } |