Fix objects being dropped from sync when dirty() re-enters mid-update
A QML binding evaluated as a side effect of updateSpatialNode() -- e.g.
Model::instanceRoot bound to Model::bounds -- can call dirty() on the
object currently being synced, from inside its own updateSpatialNode()
call. That could leave the object dirty-flagged but linked into no
dirty list at all, silently dropping the pending change until some
unrelated future change happened to re-link it.
In updateResources(), updateNodes(), and updateExtensions(), unlink the
object via removeFromDirtyList() before calling updateSpatialNode().
dirtyAttributes is already cleared by then, so a reentrant dirty() call
sees prevDirtyItem == nullptr and re-links the object through its own
addToDirtyList(), the same path any other dirty() call takes. Each sync
pass detaches the scene manager's list head into a local variable
first, so the re-added object lands on the real (already emptied) list
and is picked up on the next sync.
Added a regression test using a plain QQuick3DObject subclass that
reentrantly dirties itself, independent of any specific object or
material type.
Task-number: QTBUG-149055
Pick-to: 6.12 6.11 6.8
Change-Id: Ia8a1d7abaccddedee6304f05e7f601cd59c9e22e
Reviewed-by: Andrei Yankovich <EndrIIMail@gmail.com>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>