[omniORB] Reference count with tie implementation
   
    R.vd.Leek@fokkerspace.nl
     
    R.vd.Leek@fokkerspace.nl
       
    Wed, 13 Sep 2000 14:47:34 +0200
    
    
  
Hate to bother you with this general CORBA question, hoping for some
help though...
-- I've got the following server implementation:
class MiTest_i {
public:
        inline MiTest_i() { cout << "object created" << endl; }
        virtual ~MiTest_i() { cout << "object deleted" << endl; }
        virtual void ping () {};
};
struct Node {
        Node (MiTest_ptr ref, Node* n) : objref(ref), next(n) {};
        MiTest_ptr objref;
        Node* next;
};
class MiTestFactory_i {
public:
        inline MiTestFactory_i() : head(NULL) {}
        virtual ~MiTestFactory_i() {}
        virtual MiTest_ptr factorize () {
                MiTest_i* mi_test_impl = new MiTest_i();
                POA_MiTest_tie<MiTest_i>* mi_test =
                        new POA_MiTest_tie<MiTest_i>(mi_test_impl);
                head = new Node(mi_test->_this(), head);
                return mi_test->_this();
        }
        virtual void destroyAllObjects () {
                while (head != NULL) {
                        CORBA::release(head->objref);
                        Node *tmp = head;
                        head = head->next;
                        delete tmp;
                }
        }
private:
        Node* head;
};
-- and the following client implementation:
                MiTestFactory_var MiTestFactoryRef =
                        MiTestFactory::_narrow(obj);
                cout << "creating " << NR_SERVER_OBJECTS <<
                        " server objects..." << endl;
                MiTest_var servers[NR_SERVER_OBJECTS];
                for (int i=0; i<NR_SERVER_OBJECTS; i++)
                        servers[i] = MiTestFactoryRef->factorize();
                // ....
		    
                MiTestFactoryRef->destroyAllObjects();
-- 
The problem is that a release in the destroyAllObjects() method doesn't
delete the MiTest objects (the destructor isn't called) and thus my
application is leaking... 
Any help is appreciated, TIA
rob.
--
Rob van der Leek
Fokker Space b.v.
Remote Sensing Group
e-mail: r.vd.leek@fokkerspace.nl
tel.: +31-(0)71-5245531