Ensure we don't crash when changing sizes after cleanup
This addresses the problems I've seen during destruction. Only encountered it when using complex layouts on a DialogButtonBox.
Pick-to: 6.2 6.3 Change-Id: I54528c8a2b57b4798d90f7e2021e3127f8404762 (cherry picked from commit 8b24d2bf1655e8491bdd74013579e09cd009e8fc in qtdeclarative)