QtUtils/ClearLayoutRecursively: Fix potential crash

Use QObject->deleteLater() instead of the delete operator to destroy
child widgets of the layout. This prevents crashes caused by pending
events trying to access the now-destroyed widget.
This commit is contained in:
Dentomologist 2024-07-21 17:25:43 -07:00
parent 7bd2a7bde3
commit 384e044437

View File

@ -17,7 +17,7 @@ void ClearLayoutRecursively(QLayout* layout)
if (child->widget()) if (child->widget())
{ {
layout->removeWidget(child->widget()); layout->removeWidget(child->widget());
delete child->widget(); child->widget()->deleteLater();
} }
else if (child->layout()) else if (child->layout())
{ {