windowthumbnail: Cleanup on scene graph invalidation
The documentation (https://doc.qt.io/qt-6/qquickitem.html#graphics-resource-handling) states that if we are doing our own low level handling of graphic resources we need to perform cleanup in 3 places:
- on item destruction
- when an item is removed from the scene (via the virtual releaseResources)
- when the scenegraph gets invalidated (via a slot invalidateSceneGraph)
We only handled the first two.
This would cause a crash if the window thumbnail is showing just an icon instead of a thumbnail and we hit one of the nvidia context loss resets. The atlas texture would be deleted, but we would keep a QSGTexture referencing something inside that for longer which would linger.
I believe we only need the texture provider to reset, but we may as well do it all.
This needs testing on Nvidia on X11 to check for regressions. I do not have that hardware anymore.