diff options
Diffstat (limited to 'php/src/php5/Communicator.cpp')
-rw-r--r-- | php/src/php5/Communicator.cpp | 52 |
1 files changed, 23 insertions, 29 deletions
diff --git a/php/src/php5/Communicator.cpp b/php/src/php5/Communicator.cpp index 333f0073675..bc12e0b8dd8 100644 --- a/php/src/php5/Communicator.cpp +++ b/php/src/php5/Communicator.cpp @@ -270,43 +270,37 @@ ZEND_METHOD(Ice_Communicator, destroy) CommunicatorInfoIPtr _this = Wrapper<CommunicatorInfoIPtr>::value(getThis() TSRMLS_CC); assert(_this); - // - // Remove all registrations. - // - { - IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(_registeredCommunicatorsMutex); - for(vector<string>::iterator p = _this->ac->ids.begin(); p != _this->ac->ids.end(); ++p) - { - _registeredCommunicators.erase(*p); - } - _this->ac->ids.clear(); - } - - // - // We need to destroy any object|value factories installed by this request. - // - _this->destroyFactories(TSRMLS_C); - Ice::CommunicatorPtr c = _this->getCommunicator(); assert(c); CommunicatorMap* m = reinterpret_cast<CommunicatorMap*>(ICE_G(communicatorMap)); assert(m); - assert(m->find(c) != m->end()); - m->erase(c); + if(m->find(c) != m->end()) // If not already destroyed + { + m->erase(c); + + // + // Remove all registrations. + // + { + IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(_registeredCommunicatorsMutex); + for(vector<string>::iterator p = _this->ac->ids.begin(); p != _this->ac->ids.end(); ++p) + { + _registeredCommunicators.erase(*p); + } + _this->ac->ids.clear(); + } - ValueFactoryManagerPtr vfm = ValueFactoryManagerPtr::dynamicCast(c->getValueFactoryManager()); - assert(vfm); - vfm->destroy(); + // + // We need to destroy any object|value factories installed by this request. + // + _this->destroyFactories(TSRMLS_C); + + ValueFactoryManagerPtr vfm = ValueFactoryManagerPtr::dynamicCast(c->getValueFactoryManager()); + assert(vfm); + vfm->destroy(); - try - { c->destroy(); } - catch(const IceUtil::Exception& ex) - { - throwException(ex TSRMLS_CC); - RETURN_NULL(); - } } ZEND_METHOD(Ice_Communicator, stringToProxy) |