[vlc-devel] [PATCH 07/18] qt: remove unnecessary invokeMethod call

Prince Gupta guptaprince8832 at gmail.com
Thu Apr 1 14:29:42 UTC 2021


---
 modules/gui/qt/medialibrary/mlurlmodel.cpp | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/modules/gui/qt/medialibrary/mlurlmodel.cpp b/modules/gui/qt/medialibrary/mlurlmodel.cpp
index b0ad992554..b32f05ba88 100644
--- a/modules/gui/qt/medialibrary/mlurlmodel.cpp
+++ b/modules/gui/qt/medialibrary/mlurlmodel.cpp
@@ -58,18 +58,14 @@ QHash<int, QByteArray> MLUrlModel::roleNames() const
 
 void MLUrlModel::addAndPlay( const QString &url )
 {
-    QMetaObject::invokeMethod(  this
-                              , [this, url]() {
-        ml_unique_ptr<vlc_ml_media_t> s{vlc_ml_get_media_by_mrl( m_ml, qtu( url ))};
-        if (!s) {
-            s.reset(vlc_ml_new_stream( m_ml, qtu( url ) ));
-        }
-        if (!s)
-            return;
-        MLItemId itemId( s->i_id, VLC_ML_PARENT_UNKNOWN );
-        m_mediaLib->addAndPlay(itemId);
-        emit resetRequested();
-    });
+    ml_unique_ptr<vlc_ml_media_t> s{vlc_ml_get_media_by_mrl( m_ml, qtu( url ))};
+    if (!s)
+        s.reset(vlc_ml_new_stream( m_ml, qtu( url ) ));
+    if (!s)
+        return;
+    MLItemId itemId( s->i_id, VLC_ML_PARENT_UNKNOWN );
+    m_mediaLib->addAndPlay(itemId);
+    emit resetRequested();
 }
 
 vlc_ml_sorting_criteria_t MLUrlModel::roleToCriteria(int role) const
-- 
2.27.0



More information about the vlc-devel mailing list