[vlc-commits] [Git][videolan/vlc][master] qt: fix initialization race in test_ml_model

François Cartegnie (@fcartegnie) gitlab at videolan.org
Tue Sep 29 05:17:17 UTC 2026



François Cartegnie pushed to branch master at VideoLAN / VLC


Commits:
80f5f608 by Mohak Malviya at 2026-09-29T07:06:38+02:00
qt: fix initialization race in test_ml_model

Call componentComplete() after adding the test data. Starting the initial load on an empty model can make testGetIndexFromID return nullopt instead of the expected row.

Fixes #30098

- - - - -


1 changed file:

- modules/gui/qt/tests/test_ml_model.cpp


Changes:

=====================================
modules/gui/qt/tests/test_ml_model.cpp
=====================================
@@ -132,7 +132,6 @@ private slots:
         m_model = std::make_unique<MLTestModel>();
         m_model->classBegin();
         m_model->setMl(m_medialib.get());
-        m_model->componentComplete();
     }
 
     void cleanup() {
@@ -165,6 +164,7 @@ private slots:
         }, Qt::SingleShotConnection);
 
         m_model->appendRange(1, 1000);
+        m_model->componentComplete();
         QTRY_COMPARE_WITH_TIMEOUT(m_model->getCount(), 1000u, 100);
     }
 
@@ -174,6 +174,7 @@ private slots:
         const int low = 1;
         const int high = 300;
         m_model->appendRange(low, high);
+        m_model->componentComplete();
 
         // let loading complete, getIndexFromID won't work for 'loading' model
         QVERIFY(QTest::qWaitFor([this] () { return !m_model->loading(); }));



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/80f5f6084f06a9e1e1e9d0b4282034fb1ee7d66e

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/80f5f6084f06a9e1e1e9d0b4282034fb1ee7d66e
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list