Op do 11 jul 2024 om 15:09 schreef Sven Meier <s...@meiers.net>:

> the ListItemModel does not hold a reference to the model of the
> ListView, so it's not its responsibility to detach it.
>

IMHO, the implementation of ListItemModel is strange. It does not hold a
direct reference to the model of the ListView, but it holds a reference to
the ListView instead. It also has a dependency on the model object (and
hence the model of) the ListView. I don't think models should hold
references to components, it should be the other way around. I think
ListItemModel should be reworked to take a reference to the model of the
ListView.

Rule of thumb: if you hold a reference to a model, you have to detach it.


I would say: if reading the object of model X requires reading the objects
of other models, the detach of model X should also detach those other
models.

Best regards,
Emond

Reply via email to