[omniORB] problem with _dispose()
Fredrik Jonsson
fredrik.jonsson@sea.ericsson.se
Mon, 20 Apr 1998 15:47:58 +0200
On Monday, April 20, 1998 2:01 PM, Yvan.Peter@cnet.francetelecom.fr
[SMTP:Yvan.Peter@cnet.francetelecom.fr] wrote:
> Hi all,
>
> When I try to dispose my object either localy or remotely (through a
> IDL remove method) the destructor is never called and any invocation
> after that would raise an exception on the client side.
>
> I am completly puzzled.
>
> Has anyone got an idea ??
Maybe:
Sequence of operation stopping an implementation object:
unbindobjectname(x); // your own unbinding
boaptr->deactivate_obj(x); // stop handling further requests
x->_dispose(); // "release" the implementation
// object
Adding unbinding and deactivation in the destructor is a convenient
programming style. Calling x->_dispose() automatically invokes
the destructor, thus cleaning up properly. The reason for your crash
must be the missing deactivate_obj(), (if I'm not completely wrong)
The reason for destructor not being called: there are still references
locally on the server side. I.e. you probably used _narrow(), _this()
in other places where it wasn't a return value, and forgot to
CORBA::release() them, I guess.
I dont know what the Corba spec says, but my own tests shows
that the object_ptr reference counter prevents deletion of service
object only on the server side, in the server process. Remote
processes reference counters does not prevent the service from
being removed, generating an exception when they are used
instead. (It makes sense in my opinion). I.e. if you keep a
object_ptr to "your self" in the implementation, dispose() doesn't
delete the object until the last reference is released, (ref count 0).
Please correct me if I'm wrong. Still learning.
-- Fredrik Jonsson
Ericsson Austria AG