[omniORB] deactivate an object
Wernke zur Borg
wernke.zur.borg at vega.de
Thu Jan 17 14:32:17 GMT 2008
>
> I have a problem with a corba factory object. With the
> function createStudent() I want to built an Object of the
> class Student, this works. But after the work the student
> object should be destroyed. Now I get an error that the
> Object is still activated. My question is, how I can
> deactivate this object in the factory class with the function
> destroy().
>
> Student_ptr createStudent(const char* name) {
> string temp;
> newStudent = new Student_impl(temp.assign(name));
> a = newStudent->_this();
> return a;//Student::_duplicate(a);
> }
>
> void destroyStudent() {
> delete newStudent;
> }
>
> Thanks.
>
You must not delete the object while it is still in use by the ORB/POA.
One correct way is to:
1. Ask the object's POA to deactivate the object with
deactivate_object().
2. Remove your implicit reference to the object with remove_ref().
You can do 2. at any time after activation. If you do not need an own
reference, you should do that immediately after activation, then
deactivate_object() will cause the object to be deleted when all
references are removed.
Cheers, Wernke
More information about the omniORB-list
mailing list