Libweston internal flat view list: always remove before insert
Replace !269 (merged) with an approach that always keeps the view links valid. Every time a view link is added to a list, it needs to be removed first.
The following discussion from !269 (merged) should be addressed:
There is another way of doing this. Instead of overwriting everything at once, we could remove the list head and initialize it. That would leave all the elements still in an "anoymous" list, one that has no head. But then we need to modify each place in code that used to assume the view link was uninitialized to first remove before it inserts. We also need to ensure that a created view has its link initialized so removing is ok, and destroying a view also removes first.
Why go through the hassle instead of doing exactly what you propose? It would give us the precondition that the link of a view is always valid. That makes reasoning about code a lot easier. I don't think there is another variable that could tell if the link is valid or not, it has all been just implicit - and as your issue proves, that code had bugs.
What do you think of the alternative approach?
weston_view_create()already initializes the link and
weston_view_destroy()removes it. So the code is already kind of relying on the link being always valid, but getting indirectly dropped from the view list was overlooked until your patch.