Fix crash when changing Pane widgets -- #7198