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/ThreadPool.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/ThreadPool.cpp')
-rw-r--r-- | cpp/src/Ice/ThreadPool.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp index 9a4a15f6c7e..e1d5165c31f 100644 --- a/cpp/src/Ice/ThreadPool.cpp +++ b/cpp/src/Ice/ThreadPool.cpp @@ -540,10 +540,10 @@ IceInternal::ThreadPool::dispatchFromThisThread(const DispatchWorkItemPtr& workI { #ifdef ICE_CPP11_MAPPING _dispatcher([workItem]() - { - workItem->run(); - }, - workItem->getConnection()); + { + workItem->run(); + }, + workItem->getConnection()); #else _dispatcher->dispatch(workItem, workItem->getConnection()); #endif @@ -702,7 +702,7 @@ IceInternal::ThreadPool::run(const EventHandlerThreadPtr& thread) // Get the next ready handler. // while(_nextHandler != _handlers.end() && - !(_nextHandler->second & ~_nextHandler->first->_disabled & _nextHandler->first->_registered)) + !(_nextHandler->second & ~_nextHandler->first->_disabled & _nextHandler->first->_registered)) { ++_nextHandler; } @@ -764,7 +764,7 @@ IceInternal::ThreadPool::run(const EventHandlerThreadPtr& thread) current._handler = ICE_GET_SHARED_FROM_THIS(_selector.getNextHandler(current.operation, _threadIdleTime)); #else current._handler = ICE_GET_SHARED_FROM_THIS(_selector.getNextHandler(current.operation, current._count, current._error, - _threadIdleTime)); + _threadIdleTime)); #endif } catch(const SelectorTimeoutException&) @@ -815,7 +815,7 @@ IceInternal::ThreadPool::run(const EventHandlerThreadPtr& thread) #else current._handler = ICE_GET_SHARED_FROM_THIS(_selector.getNextHandler(current.operation, current._count, - current._error, _serverIdleTime)); + current._error, _serverIdleTime)); #endif } catch(const SelectorTimeoutException&) @@ -989,6 +989,14 @@ IceInternal::ThreadPool::startMessage(ThreadPoolCurrent& current) _workQueue->queue(new FinishedWorkItem(current._handler, false)); _selector.finish(current._handler.get()); } +#ifdef ICE_OS_UWP + // If async operations are no longer pending, clear the completion handler to break + // the cyclic reference count. + if(!current._handler->_started) + { + current._handler->getNativeInfo()->setCompletedHandler(nullptr); + } +#endif return false; } } |