summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbala <balanatarajan@users.noreply.github.com>2003-10-16 14:39:25 +0000
committerbala <balanatarajan@users.noreply.github.com>2003-10-16 14:39:25 +0000
commitf300e21d333f4009cadf3cdc32e4a2314a25bcde (patch)
tree65d35b398f77c2da8535129ff1416c814e9b3f77
parent225ae94028a932eeaae5ab7dcc5b890574cbe307 (diff)
downloadATCD-f300e21d333f4009cadf3cdc32e4a2314a25bcde.tar.gz
ChangeLogTag:Thu Oct 16 09:37:25 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu>
-rw-r--r--TAO/ChangeLog_ref8
-rw-r--r--TAO/tao/Messaging/Asynch_Invocation.cpp36
-rw-r--r--TAO/tao/Messaging/Asynch_Invocation_Adapter.cpp30
3 files changed, 44 insertions, 30 deletions
diff --git a/TAO/ChangeLog_ref b/TAO/ChangeLog_ref
index cc7ce358506..f3def441c75 100644
--- a/TAO/ChangeLog_ref
+++ b/TAO/ChangeLog_ref
@@ -1,3 +1,11 @@
+Thu Oct 16 09:37:25 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu>
+
+ * tao/Messaging/Asynch_Invocation_Adapter.cpp:
+ * tao/Messaging/Asynch_Invocation.cpp: Moved the auto_ptr <> from
+ the adapter class to the block of code that invokes
+ interceptors. That is the only point where we need to be careful
+ of not leaking the memory allocated for the reply_handler.
+
Wed Oct 15 17:40:46 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu>
* tao/Collocated_Invocation.h: Changed the inheritance to be
diff --git a/TAO/tao/Messaging/Asynch_Invocation.cpp b/TAO/tao/Messaging/Asynch_Invocation.cpp
index 9b9b7724c4d..4a19f8f5c74 100644
--- a/TAO/tao/Messaging/Asynch_Invocation.cpp
+++ b/TAO/tao/Messaging/Asynch_Invocation.cpp
@@ -59,10 +59,18 @@ namespace TAO
Invocation_Status s = TAO_INVOKE_FAILURE;
#if TAO_HAS_INTERCEPTORS == 1
+ // This auto_ptr is required when interceptors are called. If any
+ // of the interceptors throws an exception or returns with an
+ // error we need to delete the reply handler.
+ auto_ptr<TAO_Asynch_Reply_Dispatcher_Base> safe_rd (this->rd_);
+
s =
this->send_request_interception (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
+ if (s != TAO_INVOKE_FAILURE)
+ safe_rd.release ();
+
if (s != TAO_INVOKE_SUCCESS)
return s;
#endif /*TAO_HAS_INTERCEPTORS */
@@ -92,6 +100,11 @@ namespace TAO
ACE_TRY_CHECK;
#if TAO_HAS_INTERCEPTORS == 1
+ // This auto_ptr is required when interceptors are called. If any
+ // of the interceptors throws an exception or returns with an
+ // error we need to delete the reply handler.
+ auto_ptr<TAO_Asynch_Reply_Dispatcher_Base> safe_rd2 (this->rd_);
+
// Nothing great on here. If we get a restart during send or a
// proper send, we are supposed to call receiver_other ()
// interception point. So we do that here
@@ -99,6 +112,9 @@ namespace TAO
this->receive_other_interception (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
+ if (tmp != TAO_INVOKE_FAILURE)
+ safe_rd2.release ();
+
// We got an error during the interception.
if (s == TAO_INVOKE_SUCCESS && tmp != TAO_INVOKE_SUCCESS)
s = tmp;
@@ -161,3 +177,23 @@ namespace TAO
return s;
}
}
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+
+template class auto_ptr<TAO_Asynch_Reply_Dispatcher_Base>;
+# if defined (ACE_LACKS_AUTO_PTR) \
+ || !(defined (ACE_HAS_STANDARD_CPP_LIBRARY) \
+ && (ACE_HAS_STANDARD_CPP_LIBRARY != 0))
+template class ACE_Auto_Basic_Ptr<TAO_Asynch_Reply_Dispatcher_Base>;
+# endif /* ACE_LACKS_AUTO_PTR */
+
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+
+#pragma instantiate auto_ptr<TAO_Asynch_Reply_Dispatcher_Base>
+# if defined (ACE_LACKS_AUTO_PTR) \
+ || !(defined (ACE_HAS_STANDARD_CPP_LIBRARY) \
+ && (ACE_HAS_STANDARD_CPP_LIBRARY != 0))
+# pragma instantiate ACE_Auto_Basic_Ptr<TAO_Asynch_Reply_Dispatcher_Base>
+# endif /* ACE_LACKS_AUTO_PTR */
+
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/tao/Messaging/Asynch_Invocation_Adapter.cpp b/TAO/tao/Messaging/Asynch_Invocation_Adapter.cpp
index 3fb32898c26..95feb09a773 100644
--- a/TAO/tao/Messaging/Asynch_Invocation_Adapter.cpp
+++ b/TAO/tao/Messaging/Asynch_Invocation_Adapter.cpp
@@ -97,8 +97,6 @@ namespace TAO
TAO_INVOKE_FAILURE);
}
- auto_ptr<TAO_Asynch_Reply_Dispatcher> safe_rd (this->rd_);
-
if (this->rd_)
{
// Cache the transport in the reply dispatcher
@@ -123,9 +121,6 @@ namespace TAO
ACE_ENV_ARG_PARAMETER);
ACE_CHECK_RETURN (TAO_INVOKE_FAILURE);
- if (s != TAO_INVOKE_FAILURE)
- (void) safe_rd.release ();
-
if (s == TAO_INVOKE_RESTART &&
asynch.is_forwarded ())
{
@@ -141,28 +136,3 @@ namespace TAO
}
} // End namespace TAO
-
-
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-
-template class auto_ptr<CORBA::SystemException>;
-template class auto_ptr<CORBA::Exception>;
-# if defined (ACE_LACKS_AUTO_PTR) \
- || !(defined (ACE_HAS_STANDARD_CPP_LIBRARY) \
- && (ACE_HAS_STANDARD_CPP_LIBRARY != 0))
-template class ACE_Auto_Basic_Ptr<CORBA::SystemException>;
-template class ACE_Auto_Basic_Ptr<CORBA::Exception>;
-# endif /* ACE_LACKS_AUTO_PTR */
-
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-
-#pragma instantiate auto_ptr<CORBA::SystemException>
-#pragma instantiate auto_ptr<CORBA::Exception>
-# if defined (ACE_LACKS_AUTO_PTR) \
- || !(defined (ACE_HAS_STANDARD_CPP_LIBRARY) \
- && (ACE_HAS_STANDARD_CPP_LIBRARY != 0))
-# pragma instantiate ACE_Auto_Basic_Ptr<CORBA::SystemException>
-# pragma instantiate ACE_Auto_Basic_Ptr<CORBA::Exception>
-# endif /* ACE_LACKS_AUTO_PTR */
-
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */