diff options
-rw-r--r-- | config/valgrind.sup | 7 | ||||
-rw-r--r-- | cpp/src/Glacier2Lib/SessionHelper.cpp | 20 | ||||
-rw-r--r-- | cpp/test/Ice/optional/AllTests.cpp | 37 |
3 files changed, 35 insertions, 29 deletions
diff --git a/config/valgrind.sup b/config/valgrind.sup index 76496ae2691..b08b7910fc6 100644 --- a/config/valgrind.sup +++ b/config/valgrind.sup @@ -27,13 +27,6 @@ fun:__log_put } { - pthread - Memcheck:Leak - fun:calloc - fun:_dl_allocate_tls -} - -{ std::string::_Rep::_S_create Memcheck:Leak ... diff --git a/cpp/src/Glacier2Lib/SessionHelper.cpp b/cpp/src/Glacier2Lib/SessionHelper.cpp index 1a9ba94809c..9dc2d51e99c 100644 --- a/cpp/src/Glacier2Lib/SessionHelper.cpp +++ b/cpp/src/Glacier2Lib/SessionHelper.cpp @@ -144,11 +144,12 @@ public: virtual void run() { _session->destroyInternal(_disconnected); + _session = 0; } private: - const SessionHelperIPtr _session; + SessionHelperIPtr _session; const Ice::DispatcherCallPtr _disconnected; }; @@ -549,12 +550,13 @@ public: _session->dispatchCallback(new ConnectFailed(_callback, _session, ex), 0); } + _session = 0; } private: const Glacier2::SessionCallbackPtr _callback; - const SessionHelperIPtr _session; + SessionHelperIPtr _session; const ConnectStrategyPtr _factory; const Ice::CommunicatorPtr _communicator; const string _finder; @@ -577,11 +579,12 @@ public: virtual void run() { _session->dispatchCallback(_call, _conn); + _session = 0; } private: - const SessionHelperIPtr _session; + SessionHelperIPtr _session; const Ice::DispatcherCallPtr _call; const Ice::ConnectionPtr _conn; }; @@ -867,7 +870,16 @@ Glacier2::SessionFactoryHelper::addThread(const SessionHelper* session, const Ic // we just replace it. // IceUtil::Mutex::Lock sync(_mutex); - _threads.insert(make_pair(session, thread)); + map<const SessionHelper*, IceUtil::ThreadPtr>::iterator p = _threads.find(session); + if(p != _threads.end()) + { + p->second->getThreadControl().join(); + p->second = thread; + } + else + { + _threads.insert(make_pair(session, thread)); + } } void diff --git a/cpp/test/Ice/optional/AllTests.cpp b/cpp/test/Ice/optional/AllTests.cpp index fe504c3c255..df84e0a0fde 100644 --- a/cpp/test/Ice/optional/AllTests.cpp +++ b/cpp/test/Ice/optional/AllTests.cpp @@ -121,7 +121,7 @@ public: test(s == "test"); IceUtil::Optional<vector<string> > o; in->read(1, o); - test(o && o->size() == 4 && + test(o && o->size() == 4 && (*o)[0] == "test1" && (*o)[1] == "test2" && (*o)[2] == "test3" && (*o)[3] == "test4"); in->read(1000, a); in->endSlice(); @@ -166,7 +166,7 @@ public: in->endObject(false); } - FPtr + FPtr getF() { return _f; @@ -188,7 +188,7 @@ public: } Ice::ObjectPtr - create(const string& typeId) + create(const string& typeId) { if(!_enabled) { @@ -219,7 +219,7 @@ public: { return new FObjectReader; } - + return 0; } @@ -237,7 +237,7 @@ typedef IceUtil::Handle<FactoryI> FactoryIPtr; InitialPrx allTests(const Ice::CommunicatorPtr& communicator, bool) -{ +{ FactoryIPtr factory = new FactoryI(); communicator->addObjectFactory(factory, ""); @@ -286,7 +286,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool) mo1->i = Test::MyEnumMember; mo1->j = MultiOptionalPrx::uncheckedCast(communicator->stringToProxy("test")); mo1->k = mo1; - mo1->bs = ByteSeq(); + mo1->bs = ByteSeq(); (*mo1->bs).push_back(5); mo1->ss = StringSeq(); mo1->ss->push_back("test"); @@ -332,6 +332,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool) mo1->bos->push_back(false); mo1->bos->push_back(true); mo1->bos->push_back(false); + mo1->ice_collectable(true); MultiOptionalPtr mo2 = new MultiOptional(*mo1); @@ -429,7 +430,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool) test(!mo4->ioopd); test(!mo4->bos); - + mo1->k = mo1; MultiOptionalPtr mo5 = MultiOptionalPtr::dynamicCast(initial->pingPong(mo1)); test(mo5->a == mo1->a); @@ -620,7 +621,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool) RecursivePtr outer = new Recursive(); outer->value = recursive1; initial->pingPong(outer); - + cout << "ok" << endl; cout << "testing marshalling of large containers with fixed size elements..." << flush; @@ -673,7 +674,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool) test(!b2->ma); test(!b2->mb); test(!b2->mc); - + b->ma = 10; b->mb = 11; b->mc = 12; @@ -757,7 +758,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool) in->startEncapsulation(); in->read(obj); in->endEncapsulation(); - test(dynamic_cast<CObjectReader*>(obj.get())); + test(dynamic_cast<CObjectReader*>(obj.get())); factory->setEnabled(false); factory->setEnabled(true); @@ -775,7 +776,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool) test(obj && dynamic_cast<DObjectReader*>(obj.get())); dynamic_cast<DObjectReader*>(obj.get())->check(); factory->setEnabled(false); - } + } cout << "ok" << endl; cout << "testing optionals with unknown classes..." << flush; @@ -818,10 +819,10 @@ allTests(const Ice::CommunicatorPtr& communicator, bool) in->startEncapsulation(); in->read(1, p2); in->read(3, p3); - + IceUtil::Optional<Ice::Byte> p4 = 0x08; in->read(89, p4); - + in->endEncapsulation(); test(p2 == 56 && p3 == 56 && !p4); @@ -1033,7 +1034,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool) IceUtil::Optional<string> p3; IceUtil::Optional<string> p2 = initial->opCustomString(p1, p3); test(!p2 && !p3); - + p1 = "test"; p2 = initial->opString("test", p3); test(p2 == "test" && p3 == "test"); @@ -1246,7 +1247,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool) IceUtil::Optional<APtr> a; in->read(2, a); in->endEncapsulation(); - test(a && *a && (*a)->requiredA == 56); + test(a && *a && (*a)->requiredA == 56); } cout << "ok" << endl; @@ -1321,7 +1322,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool) in = Ice::createInputStream(communicator, outEncaps); in->startEncapsulation(); - in->endEncapsulation(); + in->endEncapsulation(); } { @@ -1588,7 +1589,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool) in = Ice::createInputStream(communicator, outEncaps); in->startEncapsulation(); - in->endEncapsulation(); + in->endEncapsulation(); } { @@ -1687,7 +1688,7 @@ allTests(const Ice::CommunicatorPtr& communicator, bool) in->startEncapsulation(); in->endEncapsulation(); } - + { if(supportsCppStringView) { |