[vlc-commits] qt: medialib: fix compatibility for Qt < 5.15

Romain Vimont git at videolan.org
Tue Feb 23 12:38:19 UTC 2021


vlc | branch: master | Romain Vimont <rom1v at videolabs.io> | Tue Feb 23 13:16:16 2021 +0100| [8fe56ab52165e52446c7eefd945b0f2a3a819a3c] | committer: Pierre Lamot

qt: medialib: fix compatibility for Qt < 5.15

QThreadPool::start() could only be called with a QRunnable before Qt
5.15, not a lambda: https://doc.qt.io/qt-5/qthreadpool.html#start-1

Use the older method instead.

Signed-off-by: Pierre Lamot <pierre at videolabs.io>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8fe56ab52165e52446c7eefd945b0f2a3a819a3c
---

 modules/gui/qt/medialibrary/medialib.cpp | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/modules/gui/qt/medialibrary/medialib.cpp b/modules/gui/qt/medialibrary/medialib.cpp
index bc5878ae0c..ffe5b1b071 100644
--- a/modules/gui/qt/medialibrary/medialib.cpp
+++ b/modules/gui/qt/medialibrary/medialib.cpp
@@ -225,9 +225,18 @@ void MediaLib::insertIntoPlaylist(const size_t index, const QVariantList &itemId
 
 void MediaLib::reload()
 {
-    m_threadPool.start([ml = m_ml] {
-        vlc_ml_reload_folder(ml, nullptr);
-    });
+    /* m_threadPool.start(lambda) is only supported since Qt 5.15 */
+    struct Task : QRunnable {
+        vlc_medialibrary_t *m_ml;
+
+        Task(vlc_medialibrary_t *ml) : m_ml(ml) {}
+        void run() override
+        {
+            vlc_ml_reload_folder(m_ml, nullptr);
+        }
+    };
+
+    m_threadPool.start(new Task(m_ml));
 }
 
 vlc_medialibrary_t* MediaLib::vlcMl()



More information about the vlc-commits mailing list