[omniORB] omniORB: Assertion failed.

John Hedges john@drystone.co.uk
Thu, 2 May 2002 13:35:40 +0100


Hi Yakov

(Sorry for mailing you directly earlier, forgot to check the header - here is the same reply again)

On Thu, May 02, 2002 at 02:41:25AM +0200, yashik@veon.com wrote:

[snip]

>      // Create a PERSISTENT LifespanPolicy object
>      PortableServer::LifespanPolicy_var lifespan = root_poa->create_lifespan_policy(PortableServer::PERSISTENT);;
>      // Create a USER_ID id_assignment policy object
>      PortableServer::IdAssignmentPolicy_var idassignment = root_poa->create_id_assignment_policy(PortableServer::USER_ID);
> 
>      // Create a new POA with the persistent lifespan policy.
>      CORBA::PolicyList pl;
>      pl.length(2);
>      pl[0] = lifespan;
>      pl[1] = idassignment;

I think this should be:

      pl[0] = PortableServer::LifespanPolicy::_duplicate( lifespan );
      pl[1] = PortableServer::IdAssignmentPolicy::_duplicate( idassignment );

This _add_ref()s the policy objects. They are _remove_ref()ed when pl goes out of scope and again when lifespan and idassignment go out of scope.
 
[snip]

>      // Destroy policy objects
>      lifespan->destroy();
>      idassignment->destroy();

[snip]

Cheers

John