diff options
author | Benoit Foucher <benoit@zeroc.com> | 2017-02-06 15:37:35 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2017-02-06 15:37:35 +0100 |
commit | cf56800aced9d820b75ddf9d29cc15afe92f7d6f (patch) | |
tree | 8417d1ccc269432f55348ac2d0a46c125e695d4c | |
parent | Fixed ICE-7558 - Reduce chances to lose datagrams by tuning the buffer size a... (diff) | |
download | ice-cf56800aced9d820b75ddf9d29cc15afe92f7d6f.tar.bz2 ice-cf56800aced9d820b75ddf9d29cc15afe92f7d6f.tar.xz ice-cf56800aced9d820b75ddf9d29cc15afe92f7d6f.zip |
Fixed ICE-7531 - ValueFactoryManager segfault
-rw-r--r-- | js/test/Ice/operations/Client.js | 2 | ||||
-rw-r--r-- | objective-c/test/Ice/operations/Client.m | 4 | ||||
-rw-r--r-- | php/test/Ice/operations/Client.php | 4 | ||||
-rw-r--r-- | python/modules/IcePy/ValueFactoryManager.cpp | 8 | ||||
-rwxr-xr-x | python/test/Ice/operations/Client.py | 3 | ||||
-rw-r--r-- | ruby/src/IceRuby/ValueFactoryManager.cpp | 7 | ||||
-rwxr-xr-x | ruby/test/Ice/operations/Client.rb | 5 |
7 files changed, 31 insertions, 2 deletions
diff --git a/js/test/Ice/operations/Client.js b/js/test/Ice/operations/Client.js index 0a540610d8c..045550a2756 100644 --- a/js/test/Ice/operations/Client.js +++ b/js/test/Ice/operations/Client.js @@ -65,7 +65,7 @@ var c = Ice.initialize(id); return Promise.try(() => allTests(out, c, Test, false) ).then(cl => cl.shutdown() - ).finally(() => c.destroy()); + ).finally(() => c.destroy().then(() => c.destroy()).then(() => c.destroy())); // Test multiple destroy calls }; exports._test = run; exports._clientAllTests = allTests; diff --git a/objective-c/test/Ice/operations/Client.m b/objective-c/test/Ice/operations/Client.m index 569e98c4106..cfad7d1e574 100644 --- a/objective-c/test/Ice/operations/Client.m +++ b/objective-c/test/Ice/operations/Client.m @@ -77,6 +77,10 @@ main(int argc, char* argv[]) #endif communicator = [ICEUtil createCommunicator:&argc argv:argv initData:initData]; status = run(communicator); + + // Test multiple communicator destroy calls. + [communicator destroy]; + [communicator destroy]; } @catch(ICEException* ex) { diff --git a/php/test/Ice/operations/Client.php b/php/test/Ice/operations/Client.php index 08b0838674e..73bed8c66fd 100644 --- a/php/test/Ice/operations/Client.php +++ b/php/test/Ice/operations/Client.php @@ -1137,6 +1137,10 @@ catch(Exception $ex) echo "ok\n"; } +# Test multiple destroy calls +$communicator->destroy(); +$communicator->destroy(); + $communicator->destroy(); exit(); diff --git a/python/modules/IcePy/ValueFactoryManager.cpp b/python/modules/IcePy/ValueFactoryManager.cpp index 5ef221b0d0e..b2bc743a525 100644 --- a/python/modules/IcePy/ValueFactoryManager.cpp +++ b/python/modules/IcePy/ValueFactoryManager.cpp @@ -169,7 +169,13 @@ IcePy::ValueFactoryManager::destroy() { Lock lock(*this); - + if(_self == 0) + { + // + // Nothing to do if already destroyed (this can occur if communicator destroy is called multiple times) + // + return; + } // // Break the cyclic reference. // diff --git a/python/test/Ice/operations/Client.py b/python/test/Ice/operations/Client.py index 6bcc4502d00..ac05c5bf42a 100755 --- a/python/test/Ice/operations/Client.py +++ b/python/test/Ice/operations/Client.py @@ -51,6 +51,9 @@ try: with Ice.initialize(sys.argv, initData) as communicator: status = run(sys.argv, communicator) + # Test multiple destroy calls + communicator.destroy() + communicator.destroy() except: traceback.print_exc() status = False diff --git a/ruby/src/IceRuby/ValueFactoryManager.cpp b/ruby/src/IceRuby/ValueFactoryManager.cpp index e125328afdf..8e54983f37c 100644 --- a/ruby/src/IceRuby/ValueFactoryManager.cpp +++ b/ruby/src/IceRuby/ValueFactoryManager.cpp @@ -219,6 +219,13 @@ IceRuby::ValueFactoryManager::destroy() { Lock lock(*this); + if(_self == Qnil) + { + // + // Nothing to do if already destroyed (this can occur if communicator destroy is called multiple times) + // + return; + } factories.swap(_factories); diff --git a/ruby/test/Ice/operations/Client.rb b/ruby/test/Ice/operations/Client.rb index 41063de9f29..ed75fc4e5c3 100755 --- a/ruby/test/Ice/operations/Client.rb +++ b/ruby/test/Ice/operations/Client.rb @@ -50,6 +50,11 @@ begin communicator = Ice.initialize(ARGV, initData) status = run(ARGV, communicator) + + # Test multiple destroy calls + communicator.destroy() + communicator.destroy() + rescue => ex puts $! print ex.backtrace.join("\n") |