issue #19978 similar crash fix, check to see if there is a parentWidget ...

...before saving position