[vlc-commits] qt: networkmediamodel: use InputItemPtr wrapper for input_item

Alexandre Janniaux git at videolan.org
Wed Jan 22 10:08:46 CET 2020


vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Fri Jan 17 15:30:52 2020 +0100| [2addd045ce655e98ba2f5bc564b6a521a9bf5a35] | committer: Thomas Guillem

qt: networkmediamodel: use InputItemPtr wrapper for input_item

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 modules/gui/qt/network/networkmediamodel.cpp | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/modules/gui/qt/network/networkmediamodel.cpp b/modules/gui/qt/network/networkmediamodel.cpp
index 740b81113b..1dbd87b841 100644
--- a/modules/gui/qt/network/networkmediamodel.cpp
+++ b/modules/gui/qt/network/networkmediamodel.cpp
@@ -289,24 +289,20 @@ void NetworkMediaModel::onItemRemoved( MediaSourcePtr,
 {
     for ( auto i = 0u; i < count; ++i )
     {
-        input_item_t* p_item = children[i]->p_item;
-        input_item_Hold( p_item );
-        QMetaObject::invokeMethod(this, [this, p_item]() {
+        InputItemPtr p_item { children[i]->p_item };
+        QMetaObject::invokeMethod(this, [this, p_item=std::move(p_item)]() {
             QUrl itemUri = QUrl::fromEncoded(p_item->psz_uri);
             auto it = std::find_if( begin( m_items ), end( m_items ), [p_item, itemUri](const Item& i) {
                 return QString::compare( qfu(p_item->psz_name), i.name, Qt::CaseInsensitive ) == 0 &&
                     itemUri.scheme() == i.mainMrl.scheme();
             });
             if ( it == end( m_items ) )
-            {
-                input_item_Release( p_item );
                 return;
-            }
+
             auto mrlIt = std::find_if( begin( (*it).mrls ), end( (*it).mrls),
                                        [itemUri]( const QUrl& mrl ) {
                 return mrl == itemUri;
             });
-            input_item_Release( p_item );
             if ( mrlIt == end( (*it).mrls ) )
                 return;
             (*it).mrls.erase( mrlIt );



More information about the vlc-commits mailing list