summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOssama Othman <ossama-othman@users.noreply.github.com>2001-03-03 23:34:10 +0000
committerOssama Othman <ossama-othman@users.noreply.github.com>2001-03-03 23:34:10 +0000
commitd33cbbeab21be66dfa98115fd9c3c43fe1ec91d9 (patch)
tree9aa76383a9701d4dc643764fbd7f99f7e0d48c18
parent7cca943fddfb8ce77617fc8afd4f12e26bbb09ee (diff)
downloadATCD-d33cbbeab21be66dfa98115fd9c3c43fe1ec91d9.tar.gz
ChangeLogTag:Sat Mar 03 15:28:34 2001 Ossama Othman <ossama@uci.edu>
-rw-r--r--TAO/ChangeLogs/ChangeLog-02a24
-rw-r--r--TAO/tao/PortableServer/Object_Adapter.cpp7
-rw-r--r--TAO/tao/PortableServer/POA.cpp24
3 files changed, 40 insertions, 15 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a
index edfa3a4052b..d877b89cac4 100644
--- a/TAO/ChangeLogs/ChangeLog-02a
+++ b/TAO/ChangeLogs/ChangeLog-02a
@@ -1,3 +1,27 @@
+Sat Mar 03 15:28:34 2001 Ossama Othman <ossama@uci.edu>
+
+ * tao/PortableServer/Object_Adapter.cpp (open):
+
+ Fixed broken memory management that I inadvertently introduced.
+ This brings the code back to what it used to do before my
+ change, but it uses a POA_Manager_var instead of an auto_ptr.
+ Using the _var allows us to remove the auto_ptr template
+ instantiation(s) for the POA_Manager. We technically shouldn't
+ be using auto_ptrs on reference counted objects anyway, even
+ though in this case there was no harm in doing so.
+
+ * tao/PortableServer/POA.cpp:
+
+ Removed auto_ptr<TAO_POA> and auto_ptr<TAO_POA_Manager> template
+ instantiations. They are no longer needed, thus reducing the
+ POA footprint slightly.
+
+ (create_POA_i):
+
+ Use a POA_var instead of an auto_ptr. The same reasoning from
+ above applies here as well, i.e. auto_ptrs should not be used on
+ reference counted objects.
+
Sat Mar 3 13:12:00 2001 Carlos O'Ryan <coryan@uci.edu>
* tao/PortableServer/Object_Adapter.cpp:
diff --git a/TAO/tao/PortableServer/Object_Adapter.cpp b/TAO/tao/PortableServer/Object_Adapter.cpp
index a17c05bcb4f..07f4668ad49 100644
--- a/TAO/tao/PortableServer/Object_Adapter.cpp
+++ b/TAO/tao/PortableServer/Object_Adapter.cpp
@@ -567,7 +567,12 @@ TAO_Object_Adapter::open (CORBA::Environment &ACE_TRY_ENV)
// The Object_Adapter will keep a reference to the Root POA so that
// on its destruction, it can check whether the Root POA has
// been destroyed yet or not.
- // this->root_->_add_ref ();
+ this->root_->_add_ref ();
+
+ // Release the POA_Manager_var since we got here without error. The
+ // TAO_POA object takes ownership of the POA_Manager object
+ // (actually it shares the ownership with its peers).
+ (void) safe_poa_manager._retn ();
}
void
diff --git a/TAO/tao/PortableServer/POA.cpp b/TAO/tao/PortableServer/POA.cpp
index 04f213688e6..9e3a0661ab0 100644
--- a/TAO/tao/PortableServer/POA.cpp
+++ b/TAO/tao/PortableServer/POA.cpp
@@ -374,17 +374,17 @@ TAO_POA::create_POA_i (const TAO_POA::String &adapter_name,
ACE_TRY_ENV),
CORBA::NO_MEMORY ());
- // Give ownership of the new map to the auto pointer. Note, that it
- // is important for the auto pointer to take ownership before
+ // Give ownership of the new map to the POA_var. Note, that it
+ // is important for the POA_var to take ownership before
// checking for exception since we may need to delete the new map.
- auto_ptr<TAO_POA> new_poa (poa);
+ PortableServer::POA_var new_poa = poa;
// Check for exception in construction of the POA.
ACE_CHECK_RETURN (0);
// Add to children map
result = this->children_.bind (adapter_name,
- new_poa.get ());
+ poa);
if (result != 0)
{
ACE_THROW_RETURN (CORBA::OBJ_ADAPTER (),
@@ -402,9 +402,13 @@ TAO_POA::create_POA_i (const TAO_POA::String &adapter_name,
// initialized, the application can initialize the POA by invoking
// find_POA with a TRUE activate parameter.
- // Everything is fine. Don't let the auto_ptr delete the
+ // Everything is fine. Don't let the POA_var release the
// implementation.
- return new_poa.release ();
+ (void) new_poa._retn (); // We could do a "return new_poa._retn()"
+ // but the return type doesn't match this
+ // method's return type.
+
+ return poa;
}
PortableServer::POA_ptr
@@ -4396,9 +4400,7 @@ template class ACE_Array<PortableServer::ObjectId>;
template class ACE_Array_Base<PortableServer::ObjectId>;
//template class ACE_Auto_Basic_Ptr<TAO_Active_Object_Map_Iterator_Impl>;
-template class ACE_Auto_Basic_Ptr<TAO_POA>;
template class ACE_Auto_Basic_Ptr<TAO_Active_Object_Map>;
-template class ACE_Auto_Basic_Ptr<TAO_POA_Manager>;
template class ACE_Map_Entry<TAO_Unbounded_Sequence<unsigned char>, TAO_ServantBase *>;
template class ACE_Hash_Map_Entry<ACE_CString, TAO_POA *>;
template class ACE_Hash_Map_Manager<ACE_CString, TAO_POA *, ACE_Null_Mutex>;
@@ -4412,9 +4414,7 @@ template class ACE_Write_Guard<ACE_Lock>;
template class ACE_Read_Guard<ACE_Lock>;
//template class auto_ptr<TAO_Active_Object_Map_Iterator_Impl>;
-template class auto_ptr<TAO_POA>;
template class auto_ptr<TAO_Active_Object_Map>;
-template class auto_ptr<TAO_POA_Manager>;
template class ACE_Node<TAO_POA *>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
@@ -4423,9 +4423,7 @@ template class ACE_Node<TAO_POA *>;
#pragma instantiate ACE_Array_Base<PortableServer::ObjectId>
//#pragma instantiate ACE_Auto_Basic_Ptr<TAO_Active_Object_Map_Iterator_Impl>
-#pragma instantiate ACE_Auto_Basic_Ptr<TAO_POA>
#pragma instantiate ACE_Auto_Basic_Ptr<TAO_Active_Object_Map>
-#pragma instantiate ACE_Auto_Basic_Ptr<TAO_POA_Manager>
#pragma instantiate ACE_Map_Entry<TAO_Unbounded_Sequence<unsigned char>, TAO_ServantBase *>
#pragma instantiate ACE_Hash_Map_Entry<ACE_CString, TAO_POA *>
#pragma instantiate ACE_Hash_Map_Manager<ACE_CString, TAO_POA *, ACE_Null_Mutex>
@@ -4439,8 +4437,6 @@ template class ACE_Node<TAO_POA *>;
#pragma instantiate ACE_Read_Guard<ACE_Lock>
//#pragma instantiate auto_ptr<TAO_Active_Object_Map_Iterator_Impl>
-#pragma instantiate auto_ptr<TAO_POA>
#pragma instantiate auto_ptr<TAO_Active_Object_Map>
-#pragma instantiate auto_ptr<TAO_POA_Manager>
#pragma instantiate ACE_Node<TAO_POA *>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */