The QML Live Preview tool exercises the problematic case of having a
QQuickWindow, then closing it, then showing another, then destroying
that, ..., and so on.
It seems that the eglfs_kms backend does not handle this gracefully:
if there was a page flip issued for a window that is then closed, the
new window will result in drm errors (like -22 EINVAL) because the
logic gets confused due to holding on to surface buffers from the old
window.
To remedy this, make sure the same cleanup is performed on a failing
atomic commit as it is done on the non-atomic code path. In addition,
reset more things in resetSurface().
Change-Id: I7e13dbbf4d74b4ed9beaf71472680a0daafb4f95
Fixes: QTBUG-82104
Reviewed-by: Christian Strømme <christian.stromme@qt.io>