diff options
author | Benoit Foucher <benoit@zeroc.com> | 2009-01-06 11:19:29 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2009-01-06 11:19:29 +0100 |
commit | 3f03b2188221f2ad756540a9008ba60b01ea10fb (patch) | |
tree | 012dac196ef352dcbaf1fd7baa76252b754a6bb4 /cpp | |
parent | Fix 3306 - Plugin -> Plug-in (diff) | |
download | ice-3f03b2188221f2ad756540a9008ba60b01ea10fb.tar.bz2 ice-3f03b2188221f2ad756540a9008ba60b01ea10fb.tar.xz ice-3f03b2188221f2ad756540a9008ba60b01ea10fb.zip |
Partial fix for bug 3538
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/Ice/CommunicatorI.cpp | 28 | ||||
-rw-r--r-- | cpp/src/Ice/PluginManagerI.cpp | 1 |
2 files changed, 16 insertions, 13 deletions
diff --git a/cpp/src/Ice/CommunicatorI.cpp b/cpp/src/Ice/CommunicatorI.cpp index 65895a3099b..609926aa1df 100644 --- a/cpp/src/Ice/CommunicatorI.cpp +++ b/cpp/src/Ice/CommunicatorI.cpp @@ -71,7 +71,7 @@ printGCStats(const IceInternal::GCStats& stats) void Ice::CommunicatorI::destroy() { - if(_instance->destroy()) + if(_instance && _instance->destroy()) { IceUtil::StaticMutex::Lock sync(gcMutex); @@ -289,15 +289,7 @@ Ice::CommunicatorI::CommunicatorI(const InitializationData& initData) // destructor is invoked. // const_cast<DynamicLibraryListPtr&>(_dynamicLibraryList) = _instance->dynamicLibraryList(); - } - catch(...) - { - __setNoDelete(false); - throw; - } - __setNoDelete(false); - { // // If this is the first communicator that is created, use that communicator's // property settings to determine whether to start the garbage collector. @@ -316,13 +308,25 @@ Ice::CommunicatorI::CommunicatorI(const InitializationData& initData) } if(++communicatorCount == 1) { - theCollector = new IceInternal::GC(gcInterval, printGCStats); + IceUtil::Handle<IceInternal::GC> collector = new IceInternal::GC(gcInterval, printGCStats); if(gcInterval > 0) { - theCollector->start(); + collector->start(); } + + // + // Assign only if start() succeeds, if it fails this makes sure stop isn't called in destroy(). + // + theCollector = collector; } } + catch(...) + { + destroy(); + __setNoDelete(false); + throw; + } + __setNoDelete(false); } Ice::CommunicatorI::~CommunicatorI() @@ -343,7 +347,7 @@ Ice::CommunicatorI::finishSetup(int& argc, char* argv[]) } catch(...) { - _instance->destroy(); + destroy(); throw; } } diff --git a/cpp/src/Ice/PluginManagerI.cpp b/cpp/src/Ice/PluginManagerI.cpp index a12eff6b937..adc25621fb8 100644 --- a/cpp/src/Ice/PluginManagerI.cpp +++ b/cpp/src/Ice/PluginManagerI.cpp @@ -118,7 +118,6 @@ Ice::PluginManagerI::destroy() if(_communicator) { - if(_initialized) { map<string, PluginPtr>::iterator r; |