[omniORB] possible bug in Policy copying

Anthony Shipman A.Shipman at vorticeresearchgroup.com
Mon Jan 31 16:51:10 GMT 2005


This was discovered in v4.0.4.  The relevant code appears to be unchanged in
4.0.5.

According to Henning and Vinoski page 450, I should be able to write code
like:
--------------------------------------------------------
PortableServer::IdAssignmentPolicy_var  idPolicy =
 rootPoa_->create_id_assignment_policy(PortableServer::USER_ID);

PortableServer::RequestProcessingPolicy_var  rpPolicy =
rootPoa_->create_request_processing_policy(PortableServer::USE_SERVANT_MANAGE
R);

CORBA::PolicyList	policies;

policies.length(2);
policies[0] = idPolicy;
policies[1] = rpPolicy;

bchPoa_ = rootPoa_->create_POA("bch", PortableServer::POAManager::_nil(),
policies);

idPolicy->destroy();
rpPolicy->destroy();
----------------------------------------------------------

This results in a duplicate call to the destructors on the rpPolicy and
idPolicy objects. The problem is that the assignment
     policies[0] = idPolicy
does not increment the reference count. The method that is executed is

_CORBA_PseudoObj_Member<CORBA::Policy, _CORBA_PseudoObj_Var<CORBA::Policy>

>::operator=(CORBA::Policy*)

which does not increment the reference count. It looks to me that there
should be a method that assigns from a Policy_var, as well as a Policy_ptr.

--
Anthony Shipman                     | Toothpicks
A.Shipman at vorticeresearchgroup.com  | Great deals on new and used items.
                                    | Search for toothpicks now! -aff
                                    | www.eBay.com




More information about the omniORB-list mailing list