[vlc-commits] Replace vlc_gc_incref() with input_item_Hold()

Rémi Denis-Courmont git at videolan.org
Sun Apr 9 16:29:04 CEST 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Apr  9 17:23:17 2017 +0300| [763cea5e20a01fbf1a0062f9aace2fe391d22f42] | committer: Rémi Denis-Courmont

Replace vlc_gc_incref() with input_item_Hold()

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

 include/vlc_fingerprinter.h                           | 2 +-
 include/vlc_input_item.h                              | 1 -
 lib/media.c                                           | 2 +-
 modules/access/dsm/sd.c                               | 2 +-
 modules/demux/playlist/playlist.c                     | 2 +-
 modules/gui/macosx/VLCPlaylistInfo.m                  | 2 +-
 modules/gui/qt/components/interface_widgets.cpp       | 4 ++--
 modules/gui/qt/components/playlist/playlist_item.cpp  | 2 +-
 modules/gui/qt/components/playlist/playlist_model.cpp | 2 +-
 modules/gui/qt/components/playlist/selector.cpp       | 2 +-
 modules/gui/qt/dialogs/epg.cpp                        | 2 +-
 modules/gui/qt/input_manager.hpp                      | 2 +-
 modules/gui/skins2/commands/cmd_vars.hpp              | 2 +-
 modules/lua/extension.c                               | 2 +-
 modules/lua/libs/input.c                              | 2 +-
 src/input/input.c                                     | 2 +-
 src/input/item.c                                      | 2 +-
 src/playlist/item.c                                   | 2 +-
 18 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/include/vlc_fingerprinter.h b/include/vlc_fingerprinter.h
index 9bed2f702f..e7986f5541 100644
--- a/include/vlc_fingerprinter.h
+++ b/include/vlc_fingerprinter.h
@@ -51,7 +51,7 @@ static inline fingerprint_request_t *fingerprint_request_New( input_item_t *p_it
     if ( !p_r ) return NULL;
     p_r->results.psz_fingerprint = NULL;
     p_r->i_duration = 0;
-    vlc_gc_incref( p_item );
+    input_item_Hold( p_item );
     p_r->p_item = p_item;
     vlc_array_init( & p_r->results.metas_array ); /* shouldn't be needed */
     return p_r;
diff --git a/include/vlc_input_item.h b/include/vlc_input_item.h
index 20bc492eca..950d25fec2 100644
--- a/include/vlc_input_item.h
+++ b/include/vlc_input_item.h
@@ -367,7 +367,6 @@ VLC_API input_item_t *input_item_Hold(input_item_t *);
 VLC_API void input_item_Release(input_item_t *);
 
 /* Historical hack... */
-#define vlc_gc_incref(i) input_item_Hold(i)
 #define vlc_gc_decref(i) input_item_Release(i)
 
 typedef enum input_item_meta_request_option_t
diff --git a/lib/media.c b/lib/media.c
index f3be2c93db..49a2bea22d 100644
--- a/lib/media.c
+++ b/lib/media.c
@@ -403,7 +403,7 @@ libvlc_media_t * libvlc_media_new_from_input_item(
         return NULL;
     }
 
-    vlc_gc_incref( p_md->p_input_item );
+    input_item_Hold( p_md->p_input_item );
 
     install_input_item_observer( p_md );
 
diff --git a/modules/access/dsm/sd.c b/modules/access/dsm/sd.c
index 1be2f31264..871cd68310 100644
--- a/modules/access/dsm/sd.c
+++ b/modules/access/dsm/sd.c
@@ -67,7 +67,7 @@ static void entry_item_append( services_discovery_t *p_sd,
         return;
     p_entry_item->p_entry = p_entry;
     p_entry_item->p_item = p_item;
-    vlc_gc_incref( p_item );
+    input_item_Hold( p_item );
     vlc_array_append( &p_sys->entry_item_list, p_entry_item );
     services_discovery_AddItem( p_sd, p_item, NULL );
 }
diff --git a/modules/demux/playlist/playlist.c b/modules/demux/playlist/playlist.c
index b2b7b7cfb9..251680ab59 100644
--- a/modules/demux/playlist/playlist.c
+++ b/modules/demux/playlist/playlist.c
@@ -203,7 +203,7 @@ int Control(demux_t *demux, int query, va_list args)
 input_item_t * GetCurrentItem(demux_t *p_demux)
 {
     input_item_t *p_current_input = input_GetItem( p_demux->p_input );
-    vlc_gc_incref(p_current_input);
+    input_item_Hold(p_current_input);
     return p_current_input;
 }
 
diff --git a/modules/gui/macosx/VLCPlaylistInfo.m b/modules/gui/macosx/VLCPlaylistInfo.m
index f2bca549bb..a02be140b5 100644
--- a/modules/gui/macosx/VLCPlaylistInfo.m
+++ b/modules/gui/macosx/VLCPlaylistInfo.m
@@ -181,7 +181,7 @@
             vlc_gc_decref(p_item);
         [_saveMetaDataButton setEnabled: NO];
         if (_p_item)
-            vlc_gc_incref(_p_item);
+            input_item_Hold(_p_item);
         p_item = _p_item;
     }
 
diff --git a/modules/gui/qt/components/interface_widgets.cpp b/modules/gui/qt/components/interface_widgets.cpp
index 33e7623552..5d034bae6f 100644
--- a/modules/gui/qt/components/interface_widgets.cpp
+++ b/modules/gui/qt/components/interface_widgets.cpp
@@ -761,7 +761,7 @@ CoverArtLabel::CoverArtLabel( QWidget *parent, intf_thread_t *_p_i )
     p_item = THEMIM->currentInputItem();
     if( p_item )
     {
-        vlc_gc_incref( p_item );
+        input_item_Hold( p_item );
         showArtUpdate( p_item );
     }
     else
@@ -780,7 +780,7 @@ void CoverArtLabel::setItem( input_item_t *_p_item )
 {
     if ( p_item ) vlc_gc_decref( p_item );
     p_item = _p_item;
-    if ( p_item ) vlc_gc_incref( p_item );
+    if ( p_item ) input_item_Hold( p_item );
 }
 
 void CoverArtLabel::showArtUpdate( const QString& url )
diff --git a/modules/gui/qt/components/playlist/playlist_item.cpp b/modules/gui/qt/components/playlist/playlist_item.cpp
index 317f30ba45..2d5a0e0c8a 100644
--- a/modules/gui/qt/components/playlist/playlist_item.cpp
+++ b/modules/gui/qt/components/playlist/playlist_item.cpp
@@ -61,7 +61,7 @@ void PLItem::init( playlist_item_t *_playlist_item, PLItem *parent )
     i_playlist_id = _playlist_item->i_id;           /* Playlist item specific id */
     p_input = _playlist_item->p_input;
     i_flags = _playlist_item->i_flags;
-    vlc_gc_incref( p_input );
+    input_item_Hold( p_input );
 }
 
 /*
diff --git a/modules/gui/qt/components/playlist/playlist_model.cpp b/modules/gui/qt/components/playlist/playlist_model.cpp
index 9315889bbc..eaaf213c54 100644
--- a/modules/gui/qt/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt/components/playlist/playlist_model.cpp
@@ -1089,7 +1089,7 @@ PlMimeData::~PlMimeData()
 
 void PlMimeData::appendItem( input_item_t *p_item )
 {
-    vlc_gc_incref( p_item );
+    input_item_Hold( p_item );
     _inputItems.append( p_item );
 }
 
diff --git a/modules/gui/qt/components/playlist/selector.cpp b/modules/gui/qt/components/playlist/selector.cpp
index 4259ac8501..544618c4df 100644
--- a/modules/gui/qt/components/playlist/selector.cpp
+++ b/modules/gui/qt/components/playlist/selector.cpp
@@ -438,7 +438,7 @@ PLSelItem * PLSelector::addItem (
 
 PLSelItem *PLSelector::addPodcastItem( playlist_item_t *p_item )
 {
-    vlc_gc_incref( p_item->p_input );
+    input_item_Hold( p_item->p_input );
 
     char *psz_name = input_item_GetName( p_item->p_input );
     PLSelItem *item = addItem( PL_ITEM_TYPE,  psz_name, false, false, podcastsParent );
diff --git a/modules/gui/qt/dialogs/epg.cpp b/modules/gui/qt/dialogs/epg.cpp
index 76354c8f8a..234162a655 100644
--- a/modules/gui/qt/dialogs/epg.cpp
+++ b/modules/gui/qt/dialogs/epg.cpp
@@ -172,7 +172,7 @@ void EpgDialog::updateInfos()
     {
         PL_LOCK; /* as input_GetItem still unfixed */
         p_input_item = input_GetItem( p_input_thread );
-        if ( p_input_item ) vlc_gc_incref( p_input_item );
+        if ( p_input_item ) input_item_Hold( p_input_item );
         PL_UNLOCK;
         vlc_object_release( p_input_thread );
         if ( p_input_item )
diff --git a/modules/gui/qt/input_manager.hpp b/modules/gui/qt/input_manager.hpp
index 078a82c048..a3e74b10f8 100644
--- a/modules/gui/qt/input_manager.hpp
+++ b/modules/gui/qt/input_manager.hpp
@@ -81,7 +81,7 @@ public:
         : QEvent( (QEvent::Type)(type) )
     {
         if( (p_item = p_input) != NULL )
-            vlc_gc_incref( p_item );
+            input_item_Hold( p_item );
     }
 
     virtual ~IMEvent()
diff --git a/modules/gui/skins2/commands/cmd_vars.hpp b/modules/gui/skins2/commands/cmd_vars.hpp
index 26e29a7f11..074fc9a88c 100644
--- a/modules/gui/skins2/commands/cmd_vars.hpp
+++ b/modules/gui/skins2/commands/cmd_vars.hpp
@@ -47,7 +47,7 @@ public:
         CmdGeneric( pIntf ), m_pItem( pItem )
     {
         if( pItem )
-            vlc_gc_incref( pItem );
+            input_item_Hold( pItem );
     }
     virtual ~CmdItemUpdate()
     {
diff --git a/modules/lua/extension.c b/modules/lua/extension.c
index 6077e301ff..c49f5336ee 100644
--- a/modules/lua/extension.c
+++ b/modules/lua/extension.c
@@ -609,7 +609,7 @@ static int Control( extensions_manager_t *p_mgr, int i_control, va_list args )
                 p_ext->p_sys->i_capabilities & EXT_META_LISTENER )
             {
                 p_item = input_GetItem( p_ext->p_sys->p_input );
-                vlc_gc_incref( p_item );
+                input_item_Hold( p_item );
                 vlc_event_attach( &p_item->event_manager,
                                   vlc_InputItemMetaChanged,
                                   inputItemMetaChanged,
diff --git a/modules/lua/libs/input.c b/modules/lua/libs/input.c
index 6d14ebce78..6ee3946cdb 100644
--- a/modules/lua/libs/input.c
+++ b/modules/lua/libs/input.c
@@ -413,7 +413,7 @@ static const luaL_Reg vlclua_input_item_reg[] = {
 
 static int vlclua_input_item_get( lua_State *L, input_item_t *p_item )
 {
-    vlc_gc_incref( p_item );
+    input_item_Hold( p_item );
     input_item_t **pp = lua_newuserdata( L, sizeof( input_item_t* ) );
     *pp = p_item;
 
diff --git a/src/input/input.c b/src/input/input.c
index 1cffe77fc7..187a75160b 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -327,7 +327,7 @@ static input_thread_t *Create( vlc_object_t *p_parent, input_item_t *p_item,
     else
         vlc_viewpoint_init( &priv->viewpoint );
 
-    vlc_gc_incref( p_item ); /* Released in Destructor() */
+    input_item_Hold( p_item ); /* Released in Destructor() */
     priv->p_item = p_item;
 
     /* Init Input fields */
diff --git a/src/input/item.c b/src/input/item.c
index 959460f2d4..dcbf2edf0a 100644
--- a/src/input/item.c
+++ b/src/input/item.c
@@ -1259,7 +1259,7 @@ input_item_node_t *input_item_node_Create( input_item_t *p_input )
     assert( p_input );
 
     p_node->p_item = p_input;
-    vlc_gc_incref( p_input );
+    input_item_Hold( p_input );
 
     p_node->p_parent = NULL;
     p_node->i_children = 0;
diff --git a/src/playlist/item.c b/src/playlist/item.c
index 9d77a663ad..5332b5204f 100644
--- a/src/playlist/item.c
+++ b/src/playlist/item.c
@@ -287,7 +287,7 @@ playlist_item_t *playlist_ItemNewFromInput( playlist_t *p_playlist,
     assert( p_item == *pp );
 
     p->i_last_playlist_id = p_item->i_id;
-    vlc_gc_incref( p_item->p_input );
+    input_item_Hold( p_item->p_input );
 
     vlc_event_manager_t *p_em = &p_item->p_input->event_manager;
 



More information about the vlc-commits mailing list