on xenial help sign in
Fixed leak in UnityMenuModelStackTest

Approved by: Albert Astals Cid

commit5652796b2e27441c051fb3b68e4392f0e9757730 authorNick Dedekind <nick.dedekind@canonical.com> dateWed 21 Oct 2015, 11:51 (11 years ago) parente3120334e39418
1 file changed+2−9
tests/plugins/Unity/Indicators/UnityMenuModelStackTest.cpp+2−9
tests/plugins/Unity/Indicators/UnityMenuModelStackTest.cpp+2−9
@@ -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;