Who deletes what

What is the rule of thumb for object deletion ?

It’s not very clear to me who is responsible for deleting what. For example, the Components returned by refreshComponentForRow or the ones added inside other Components.

Some things I figured out:

  1. I can delete a component that was added to another component and it is removed.
  2. I should call deleteAllChildren() if I want contained components to be deleted.
  3. What about components returned by refreshComponentForRow ? Should I call ListBox::deleteAllChildren() ?

Ohh, sorry.

The answer to my question is in the API docs:

The component that your method returns will be deleted by the ListBox when it is no longer needed.