Detach dirty-list items when destroying a scene manager
A front-end object that is on one of a scene manager's dirty lists keeps
a prevDirtyItem pointer into the manager's dirtyNodes, dirtyResources or
dirtyExtensions arrays. Those arrays are members of the scene manager and
are freed together with it.
Items are normally taken off the dirty list as they are processed in
synchronize(), but that only happens for active scene managers. A manager
that has been queued for cleanup is deleted without its dirty lists being
drained, so any item still dirty at that point is left with a dangling
prevDirtyItem. When that object is later destroyed, or removed from the
dirty list it can end-up touching the dangling pointer.
With this change we now make sure to clear the pointers in the scene
managers destructor. If any objects are shared between views will get
re-adopted and added to the dirty list again.
Add tests for testing that object are re-adoptable and that shared
scenes triggers the re-adoption process when the main caretaker is
destroyed.
Pick-to: 6.12 6.11
Change-Id: I8de18f90c10c7b3b174eefcaa940728b3413cd3e
Reviewed-by: Andy Nichols <andy.nichols@qt.io>