Re: question about deleting objects



On Mon, 4 Sep 2000, Andrew Murie wrote:

> The big question I have is: How do you delete an object after it has
> been created?
> 
> An impl_classname_destroy method is created automatically by the
> IDL compiler, but I can't see for certain how this can be called in a
> useful manner. There isn't a stub routine created that matches this.

This impl_classname_destroy() routine is broken and should be ignored.

The answer is that you have to provide your own method to serve as a
destructor - it is not at all standardized in the CORBA spec (although the
CORBA lifecycle spec may have its ideas on this).

> but I want to find out exactly what I should be doing to delete an
> object.

In your destroy() method, you need to do something like:
                PortableServer_POA_deactivate_object (my_poa (), servant_object_id, ev);
                POA_classname__fini (servant, ev);
(assuming you are using the 'normal' method of activating
servants/objects).

You can get the object_id for the servant either by using the return value
of PortableServer_POA_activate_object(), or by calling
PortableServer_POA_servant_to_id() in your destructor.

-- Elliot
DEAR IRS, Please cancel my subscription.







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]