raffaello-camoriano / RBDemo

Reactive Behaviors Demo
1 stars 0 forks source link

Garbage collection #8

Closed pattacini closed 10 years ago

pattacini commented 10 years ago

Something is left unhandled if you reach this line...

raffaello-camoriano commented 10 years ago

actionL and actionR pointers set to NULL after deletion of the pointed objects.

pattacini commented 10 years ago

Nope...

raffaello-camoriano commented 10 years ago

Pushed now.

pattacini commented 10 years ago

The problem is not the one you mentioned. I was referring to something else.

pattacini commented 10 years ago

Hint: what happens to the action class handling the left arm if the one for the right arm fails to start?

raffaello-camoriano commented 10 years ago

My 2 cents: Both should be deleted and the module should stop and quit if either of the two actions is not instantiated correctly. I think I'll do something like the following:

        cout<<"***** Instantiating primitives for left hand"<<endl;
        actionL = new AFFACTIONPRIMITIVESLAYER(optionL);
        cout<<"***** Instantiating primitives for right hand"<<endl;
        actionR=new AFFACTIONPRIMITIVESLAYER(optionR);
        if (!actionR->isValid() || !actionL->isValid() )
        {
            delete actionR;
            actionR = NULL;
            delete actionL;
            actionL = NULL;
            return false;
        }

By the way, I was thinking about the following:

 virtual bool getGraspModel(perception::Model *&model) const;

Especially on *Model &**, a reference to a pointer to a Model. I have to think about how it works.

pattacini commented 10 years ago

:+1: