If the window that the sheet (as created for a modal dialog) lives in
has already been destroyed by the time the sheet is hidden, then we used
to trip an assertion. Instead, always use the sheetParent, which is
still alive.
Add a test case that asserts without the fix.
Fixes: QTBUG-128302
Change-Id: I4c399b73e2552bab79358c5505f403efa8e4f80b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
(cherry picked from commit 332f49f2d8c5675bab8bde6acfb377d567961d4a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>