[omniORB] "A Servant has been deleted that is still activated"

Duncan Grisby dgrisby@uk.research.att.com
Wed, 23 May 2001 12:10:13 +0100


On Tuesday 22 May, "Read, Gordon" wrote:

[...]
> MyExample::MyExample()
>   : _sk_Example() {
>   cout << "MyExample::MyExample()" << endl;
>   _obj_is_ready(boa);
> }

[...]
>   MyExample* theExample = new MyExample;
>   cout << "about to do: delete theExample;" << endl;
>   delete theExample;

[...]
> about to do: delete theExample;
> omniORB: ERROR -- A servant has been deleted that is still activated.
>       id: boa<0x3b0a7b8b71f8d9f100000001>

The problem is that you have activated the servant in the BOA with the
call to _obj_is_ready(). The BOA now owns it, and you must not delete
it yourself. You get rid of the servant by calling its _dispose()
method:

   MyExample* theExample = new MyExample;
   cout << "about to do: dispose theExample;" << endl;
   theExample->_dispose();

That will unregister it from the BOA, and delete it.

The rules were the same with omniORB 2.8, but it was much less strict
about checking such things.

Cheers,

Duncan.

-- 
 -- Duncan Grisby  \  Research Engineer  --
  -- AT&T Laboratories Cambridge          --
   -- http://www.uk.research.att.com/~dpg1 --