[omniORB] basic parameter passing question

Luke Deller ldeller at xplantechnology.com
Mon Dec 5 10:15:34 GMT 2005


On Thu, 2005-12-01 at 11:37 +0100, Lolke B. Dijkstra wrote:
> Again:
> 
> 1.  isdn::BChannelControlClient_var retval = bchan->getControl();
> 2.  return retval._retn();
> 
> 1. the call to bchan->getControl() returns a pointer to an object that 
> is that assigned to retval so reval becomes the owner

No, in Anthony's code bchan->getControl() returns a reference to a _var
object, not a _ptr.  The constructor of retval will actually duplicate
the contained object reference for itself.

> 2. you return the internal pointer and instruct retval to give up ownership
> 
> 
> In:
> 
>    return isdn::BChannelControlClient::_duplicate(bchan->getControl());
> 
> you also call bchan->getControl() but you do not assign the pointer to a ref, so nothing takes ownership of the return value of bchan->getControl() hence your leak.

Again, bchan->getControl() returns a _var& , not a _ptr, so this
explanation does not apply; it should not leak.

As I suggested in my last email, this confusion seems to have arisen due
to the unconventional return type in Anthony's getControl() function.

Regards,
Luke.


**********************************************************************************************

Important Note
This email (including any attachments) contains information which is
confidential and may be subject to legal privilege.  If you are not
the intended recipient you must not use, distribute or copy this
email.  If you have received this email in error please notify the
sender immediately and delete this email. Any views expressed in this
email are not necessarily the views of XPlan Technology.

It is the duty of the recipient to virus scan and otherwise test the
information provided before loading onto any computer system.
Xplan Technology does not warrant that the
information is free of a virus or any other defect or error.
**********************************************************************************************




More information about the omniORB-list mailing list