@@ -43,8 +43,8 @@ private Q_SLOTS:
4343 {
4444 delete m_model;
4545 m_model = nullptr;
46− // quick wait cycle for deleteLaters to act.
47− waitFor([]{ return false;}, 1);
46+ // send deleteLaters to avoid leaks.
47+ QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
4848 }
4949
5050 void testHeadOnSetHead()
@@ -148,19 +148,10 @@ private Q_SLOTS:
148148
149149 m_model->removeRow(removeIndex);
150150
151− waitFor([&stack, resultCount]() { return stack.count() == resultCount; }, 1000);
152151 QCOMPARE(stack.count(), resultCount);
153152 }
154153
155154private:
156− bool waitFor(std::function<bool()> functor, int ms) {
157−
158− QElapsedTimer timer;
159− timer.start();
160− while(!functor() && timer.elapsed() < ms) { QTest::qWait(10); }
161− return functor();
162− }
163−
164155 QVariant recuseAddMenu(int subMenuCount, int depth_remaining)
165156 {
166157 QVariantList rows;