[omniORB] Releasing ties.

PJ McKenna pj.mckenna@datalex.ie
Tue, 1 Jun 1999 19:17:00 +0100


Folks,
  Say some optimist was fiddling around with tie-based implementations and
was trying to release an object.

  Here's the code to get a "Session" object :

  	Session *GetSession() {
		Session_i *myimpl = new Session_i();
		_tie_Session<Session_i,1> *myobj = new
_tie_Session<Session_i,1>(myimpl);
		myobj->_obj_is_ready(boa);
		Session_ptr myobjRef = myobj->_this();
		if (!bindObjectToName(orb,myobjRef, "Session")) {
			return Session::_nil();
		}
		return myobj;
	};


  and here's the code to release it :

	void ReleaseSession ( Session_ptr  ToRelease ) {
		CORBA::release(ToRelease);
	};

  When ReleaseSession is called, "CORBA::release(ToRelease)" causes the
reference count of ToRelease to drop from 2 to 1.  At some point in the
skeleton code this drops to 0.
  My understanding of how this should work is that if the second parameter
to "_tie_Session<Session_i,1>" is 1 (true) then when the reference count
hits 0 the implementation object (myimpl) should be destroyed.  However, the
Session object has a (virtual) destructor which is never called.
  I know that a _dispose() method exists for _sk_Session - derived objects
but I can't find one for the tie approach.
  Anyone willing to give me some pointers?
  
  - P.J. Mc Kenna