@@ -43,6 +43,8 @@ private Q_SLOTS:
4343 {
4444 delete m_model;
4545 m_model = nullptr;
46+ // send deleteLaters to avoid leaks.
47+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
4648 }
4749
4850 void testHeadOnSetHead()
@@ -146,19 +148,10 @@ private Q_SLOTS:
146148
147149 m_model->removeRow(removeIndex);
148150
149− waitFor([&stack, resultCount]() { return stack.count() == resultCount; }, 1000);
150151 QCOMPARE(stack.count(), resultCount);
151152 }
152153
153154private:
154− bool waitFor(std::function<bool()> functor, int ms) {
155−
156− QElapsedTimer timer;
157− timer.start();
158− while(!functor() && timer.elapsed() < ms) { QTest::qWait(10); }
159− return functor();
160− }
161−
162155 QVariant recuseAddMenu(int subMenuCount, int depth_remaining)
163156 {
164157 QVariantList rows;