diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/Ice/CommunicatorI.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/cpp/src/Ice/CommunicatorI.cpp b/cpp/src/Ice/CommunicatorI.cpp index dc41f2849f2..db6547e34aa 100644 --- a/cpp/src/Ice/CommunicatorI.cpp +++ b/cpp/src/Ice/CommunicatorI.cpp @@ -32,13 +32,22 @@ using namespace IceInternal; void Ice::CommunicatorI::destroy() { - RecMutex::Lock sync(*this); + InstancePtr instance; - if(!_destroyed) // Don't destroy twice. { - _destroyed = true; - _serverThreadPool = 0; - _instance->destroy(); + RecMutex::Lock sync(*this); + + if(!_destroyed) // Don't destroy twice. + { + _destroyed = true; + _serverThreadPool = 0; + instance = _instance; + } + } + + if(instance) + { + instance->destroy(); } } |