Re: Newbie questions + bug report...



Justin Schoeman wrote:

> Hi all, I am a newbie to CORBA and ORBit, so please excuse any 
> irrelevant ramblings...
>

> runs in its own thread, and all is well, however, I have no idea how 
> to create a destructor for the server side object.  If I call:
> impl_Echo_Echo__destroy(servant, ev);
> in the destructor, the objects memory is freed, but it remains 
> registered with the POA, so shutting down the main ORB results in a 
> segfault when the POA tries to release the object.  If I call:
> PortableServer_POA_deactivate_object(servant->poa, objid, ev);
> in the destructor, everything seems to work fine (even the __destroy 
> method is called by the POA), _but_ the system leaks memory.
>
> What is the correct way to destroy a server side object?

Shame on me, it is a bug in orbit-documentation. You need to call

PortableServer_ObjectId* oid =  PortableServer_POA_servant_to_id(poa, 
servant, ev);
PortableServer_POA_deactivate_object  (poa, oid, ev);

this will deregister your object from POA, and will invoke objects 
associated finalizer __fini.
If servant is calling "deactivate_object" in scope of method call, 
invocation of finalizer is delayed.

Currently I am fixing this chapter in orbit documentation.

> Also, how do you shut down the ORB cleanly in a multi-threaded 
> environment?  I use the signal handlers as in the examples, but this 
> gives an error that shudwon must be called from the main thread... Hiw 
> do I get around this?
>
please attach error message.

Best regards, Frank





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