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:
parent
7bd2a7bde3
commit
384e044437
|
@ -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())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue