From 838688e00f638f70137102e2d1593eb9cc4a5484 Mon Sep 17 00:00:00 2001 From: Sebastian Englbrecht Date: Wed, 27 May 2026 20:00:21 +0200 Subject: barsecondrowflowlayout: avoid virtual call in destructor cppcheck warns about calling virtual functions during destruction because dynamic dispatch is no longer reliable at that point. Replace takeAt(0) with direct access to itemList.takeFirst() to drain the list without going through the virtual interface. --- src/search/barsecondrowflowlayout.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/search/barsecondrowflowlayout.cpp') diff --git a/src/search/barsecondrowflowlayout.cpp b/src/search/barsecondrowflowlayout.cpp index 29e3513e8..3ef035f16 100644 --- a/src/search/barsecondrowflowlayout.cpp +++ b/src/search/barsecondrowflowlayout.cpp @@ -25,9 +25,8 @@ BarSecondRowFlowLayout::BarSecondRowFlowLayout(QWidget *parent) BarSecondRowFlowLayout::~BarSecondRowFlowLayout() { - QLayoutItem *item; - while ((item = takeAt(0))) - delete item; + while (!itemList.isEmpty()) + delete itemList.takeFirst(); } void BarSecondRowFlowLayout::addItem(QLayoutItem *item) -- cgit v1.3.1