diff options
Diffstat (limited to 'TAO/tao/PI/PICurrent_Impl.cpp')
-rw-r--r-- | TAO/tao/PI/PICurrent_Impl.cpp | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/TAO/tao/PI/PICurrent_Impl.cpp b/TAO/tao/PI/PICurrent_Impl.cpp index ecbccc90274..4aa071e258c 100644 --- a/TAO/tao/PI/PICurrent_Impl.cpp +++ b/TAO/tao/PI/PICurrent_Impl.cpp @@ -1,4 +1,4 @@ -#include "PICurrent_Impl.h" +#include "tao/PI/PICurrent_Impl.h" #if TAO_HAS_INTERCEPTORS == 1 @@ -8,14 +8,17 @@ ACE_RCSID (tao, #if !defined (__ACE_INLINE__) -# include "PICurrent_Impl.inl" +# include "tao/PI/PICurrent_Impl.inl" #endif /* __ACE_INLINE__ */ -#include "PICurrent_Copy_Callback.h" +#include "tao/PI/PICurrent_Copy_Callback.h" #include "tao/TAO_Server_Request.h" #include "tao/SystemException.h" #include "ace/Log_Msg.h" +#include "tao/debug.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO::PICurrent_Impl::PICurrent_Impl (void) : slot_table_ (), @@ -44,9 +47,16 @@ TAO::PICurrent_Impl::get_slot (PortableInterceptor::SlotId identifier // No need to check validity of SlotId. It is validated before this // method is invoked. + // Get the slot table that is currently active PICurrent_Impl::Table & table = this->current_slot_table (); - ACE_ASSERT (this->lc_slot_table_ != &this->slot_table_); + // The active slot table should never be a lazy copy of itself! + if (this->lc_slot_table_ == &this->slot_table_) + { + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) Lazy copy of self detected at %N,%l"))); + ACE_THROW (CORBA::INTERNAL ()); + } CORBA::Any * any = 0; @@ -90,10 +100,20 @@ TAO::PICurrent_Impl::set_slot (PortableInterceptor::SlotId identifier, // method is invoked. // Perform deep copy of the logically copied slot table, if - // necessary, before modifying our own slot table. - if (this->copy_callback_ != 0 - && this->copy_callback_->execute () != 0) - ACE_THROW (CORBA::INTERNAL ()); + // necessary, before modifying our own slot table. This is a setup + // where another PICurrent refers to our slot table, so we force the + // the other PICurrent does copy our table before making changes to + // our table. + if (this->copy_callback_ != 0) + this->copy_callback_->execute (); + + // If we have a logical copied slot table we refer to, just make a + // copy of that table first before making changes to our table. + if (this->lc_slot_table_ != 0) + { + this->slot_table_ = *this->lc_slot_table_; + this->lc_slot_table_ = 0; + } // If the slot table array isn't large enough, then increase its // size. We're guaranteed not to exceed the number of allocated @@ -109,7 +129,15 @@ void TAO::PICurrent_Impl::execute_destruction_callback ( TAO::PICurrent_Impl::Table * old_lc_slot_table) { + // we are being asked to lc another table, if this + // is null, make sure we take a physical copy of the + // existing table we had lc before it disappears. + if ((0 == old_lc_slot_table) && (0 != this->lc_slot_table_)) + this->slot_table_ = *this->lc_slot_table_; + this->lc_slot_table_ = old_lc_slot_table; } +TAO_END_VERSIONED_NAMESPACE_DECL + #endif /* TAO_HAS_INTERCEPTORS == 1 */ |