Qt: fix flow_layout segfault

This commit is contained in:
Megamouse 2024-12-19 12:42:11 +01:00
parent 9d4ff13c2b
commit 79fc366f23

View File

@ -79,7 +79,8 @@ flow_layout::~flow_layout()
void flow_layout::clear()
{
for (QLayoutItem* item : m_item_list)
// We can't use a ranged loop here, since deleting the widget will call takeAt on the layout. So let's also use takeAt.
while (QLayoutItem* item = takeAt(0))
{
if (item)
{