[omniNotify] Re: [omniORB] Deleting a StructuredPushConsumer

Jon Dyte jon at totient.demon.co.uk
Wed Jun 16 00:42:11 BST 2004


Hi Duncan


I stand corrected; thanks for pointing that out.

However wont Frederic still need to  call _remove_ref() after he creates 
event_observer on the heap, if he wants event_observer to be deleted as part 
of the sequence which begins with a call to deactivate_object?

eg
event_observer = new MyObserver ;
CosNotifyComm::StructuredPushConsumer_var push_consumer ;
....
push_consumer = eventObserver->_this() ;
event_observer->_remove_ref();

In omniORB the POA calls _add_ref when it activates the servant, in which
case the ref count will be two, assuming the ref count is 1 as a result of the 
new. 
( I ask because I've mainly looked at this in TAO!) 


Jon


On Tuesday 15 June 2004 21:54, Duncan Grisby wrote:
> On Tuesday 15 June, Jon Dyte wrote:
> > you are activating the eventObserver object via _this which will put
> > it in the RootPOA. When you delete event observer the ORB is
> > complaining that there is still a reference in the active object
> > map.
>
> That is correct.
>
> > I think you need a servant activator, but you still manually do the
> > activation, but use the etherealise method to safely destroy the
> > event_observer.
>
> While it will work to do that, it's a big waste of effort. If you
> don't have a servant activator, a call to deactivate_object eventually
> ends up with a remove_ref on the servant. There's no need to create a
> servant activator to do the same thing.
>
> It is fine to activate your consumer in the Root POA. Just get rid of
> it with deactivate_object rather than by deleting it directly.
>
> Cheers,
>
> Duncan.




More information about the omninotify-list mailing list