summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2006-10-24 01:59:22 +0000
committerBernard Normier <bernard@zeroc.com>2006-10-24 01:59:22 +0000
commitd38dd2de23986dba846fae8454d60b6711b964b3 (patch)
tree41523b39de7512673f83e1e1831c62bf367cf99c /cpp/src
parentchanging archive name (diff)
downloadice-d38dd2de23986dba846fae8454d60b6711b964b3.tar.bz2
ice-d38dd2de23986dba846fae8454d60b6711b964b3.tar.xz
ice-d38dd2de23986dba846fae8454d60b6711b964b3.zip
ImplicitContext test and fixes
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/ImplicitContextI.cpp9
-rw-r--r--cpp/src/Ice/Instance.cpp2
-rw-r--r--cpp/src/Ice/SharedContext.h4
3 files changed, 11 insertions, 4 deletions
diff --git a/cpp/src/Ice/ImplicitContextI.cpp b/cpp/src/Ice/ImplicitContextI.cpp
index ab57af890d9..b6b8294210b 100644
--- a/cpp/src/Ice/ImplicitContextI.cpp
+++ b/cpp/src/Ice/ImplicitContextI.cpp
@@ -362,7 +362,7 @@ PerThreadImplicitContext::getThreadContext(bool allocate) const
return 0;
}
- val = new std::vector<Context*>(_index);
+ val = new std::vector<Context*>(_index + 1);
#ifdef _WIN32
if(TlsSetValue(_key, val) != 0)
{
@@ -377,7 +377,7 @@ PerThreadImplicitContext::getThreadContext(bool allocate) const
}
else
{
- if(val->size() < _index)
+ if(val->size() <= _index)
{
if(!allocate)
{
@@ -386,6 +386,7 @@ PerThreadImplicitContext::getThreadContext(bool allocate) const
else
{
val->resize(_index + 1);
+ assert((*val)[_index] == 0);
}
}
}
@@ -409,8 +410,9 @@ PerThreadImplicitContext::clearThreadContext() const
#else
ContextVector* val = static_cast<ContextVector*>(pthread_getspecific(_key));
#endif
- if(val != 0 && val->size() < _index)
+ if(val != 0 && _index < val->size())
{
+ delete (*val)[_index];
(*val)[_index] = 0;
int i = val->size() - 1;
@@ -465,6 +467,7 @@ PerThreadImplicitContext::setContext(const Context& newContext)
else
{
Context* ctx = getThreadContext(true);
+ assert(ctx != 0);
*ctx = newContext;
}
}
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp
index 427bb3a5585..7d552f62d27 100644
--- a/cpp/src/Ice/Instance.cpp
+++ b/cpp/src/Ice/Instance.cpp
@@ -466,7 +466,7 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Initi
_serverACM(0),
_threadPerConnection(0),
_threadPerConnectionStackSize(0),
- _defaultContext(new SharedContext(initData.defaultContext)),
+ _defaultContext(new SharedContext),
_memoryPool(0),
_implicitContext(0)
{
diff --git a/cpp/src/Ice/SharedContext.h b/cpp/src/Ice/SharedContext.h
index 00982f43b78..729f0ada564 100644
--- a/cpp/src/Ice/SharedContext.h
+++ b/cpp/src/Ice/SharedContext.h
@@ -26,6 +26,10 @@ namespace IceInternal
class SharedContext : public IceUtil::Shared
{
public:
+
+ SharedContext()
+ {
+ }
SharedContext(const Ice::Context& val) :
_val(val)