diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/Ice/CollocatedRequestHandler.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/cpp/src/Ice/CollocatedRequestHandler.cpp b/cpp/src/Ice/CollocatedRequestHandler.cpp index f6ab4092aa5..4fbf0d0bc7b 100644 --- a/cpp/src/Ice/CollocatedRequestHandler.cpp +++ b/cpp/src/Ice/CollocatedRequestHandler.cpp @@ -306,6 +306,13 @@ CollocatedRequestHandler::invokeAsyncRequest(OutgoingAsyncBase* outAsync, int ba } else // Optimization: directly call invokeAll if there's no dispatcher. { + // + // Make sure to hold a reference on this handler while the call is being + // dispatched. Otherwise, the handler could be deleted during the dispatch + // if a retry occurs. + // + CollocatedRequestHandlerPtr self(shared_from_this()); + if(sentAsync(outAsync)) { invokeAll(outAsync->getOs(), requestId, batchRequestNum); |