Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
5fb0778a by Fatih Uzunoglu at 2026-02-05T12:34:44+00:00
qt: implement `QQuickImageResponse::cancel()` in `CustomCoverImageResponse`

- - - - -


1 changed file:

- modules/gui/qt/medialibrary/mlcustomcover.cpp


Changes:

=====================================
modules/gui/qt/medialibrary/mlcustomcover.cpp
=====================================
@@ -201,12 +201,33 @@ public:
         return QStringLiteral("");
     }
 
+public Q_SLOTS:
+    void cancel() override
+    {
+        if (m_taskId1)
+        {
+            ml->cancelMLTask(this, m_taskId1);
+            m_taskId1 = 0;
+        }
+
+        if (m_taskId2)
+        {
+            ml->cancelMLTask(this, m_taskId2);
+            m_taskId2 = 0;
+        }
+
+        emit finished();
+    }
+
 private:
     void start()
     {
         const int thumbnailCount = data.countX * data.countY;
 
-        ml->runOnMLThread<ThumbnailList>(this,
+        if (m_taskId1)
+            ml->cancelMLTask(this, m_taskId1);
+
+        m_taskId1 = ml->runOnMLThread<ThumbnailList>(this,
             //ML thread (get child thumbnails or ids)
             [itemId = data.id, thumbnailCount](vlc_medialibrary_t *p_ml, 
ThumbnailList &ctx)
             {
@@ -243,7 +264,10 @@ private:
     {
         struct Context { QImage img; };
 
-        ml->runOnMLThread<Context>(this,
+        if (m_taskId2)
+            ml->cancelMLTask(this, m_taskId2);
+
+        m_taskId2 = ml->runOnMLThread<Context>(this,
             //ML thread
             [data = this->data, thumbnails]
             (vlc_medialibrary_t * , Context & ctx)
@@ -278,6 +302,7 @@ private:
     MediaLib *ml;
     CoverData data;
     QImage image;
+    quint64 m_taskId1 = 0, m_taskId2 = 0;
 };
 
 



View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/5fb0778a529ab0e1e8dfaec0099ea3073770efcd

-- 
View it on GitLab: 
https://code.videolan.org/videolan/vlc/-/commit/5fb0778a529ab0e1e8dfaec0099ea3073770efcd
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance
_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to