Commit 513a8db0 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Remove the unsafe input item array

parent 08cc2b3a
......@@ -60,7 +60,6 @@ struct input_item_t
{
VLC_GC_MEMBERS
int i_id; /**< Identifier of the item */
libvlc_int_t *p_libvlc;
char *psz_name; /**< text describing this item */
char *psz_uri; /**< mrl of this item */
......@@ -187,9 +186,6 @@ VLC_EXPORT(int, input_item_AddInfo, ( input_item_t *p_i, const char *psz_cat, co
VLC_EXPORT( input_item_t *, __input_item_NewExt, (vlc_object_t *, const char *, const char*, int, const char *const *, mtime_t i_duration ) );
VLC_EXPORT( input_item_t *, input_item_NewWithType, ( vlc_object_t *, const char *, const char *e, int, const char *const *, mtime_t i_duration, int ) );
#define input_item_GetById(a,b) __input_item_GetById( VLC_OBJECT(a),b )
VLC_EXPORT( input_item_t *, __input_item_GetById, (vlc_object_t *, int ) );
/*****************************************************************************
* Meta data helpers
*****************************************************************************/
......
......@@ -370,22 +370,8 @@ char *input_item_GetInfo( input_item_t *p_i,
static void input_item_Destroy ( gc_object_t *gc )
{
input_item_t *p_input = vlc_priv(gc, input_item_t);
libvlc_int_t *p_libvlc = p_input->p_libvlc;
int i;
input_item_Clean( p_input );
/* This is broken. Items must be removed from any table before their
* reference count drops to zero (unless the table is not used, but then
* why have it?). Full point, no buts. -- Courmisch */
libvlc_priv_t *priv = libvlc_priv (p_libvlc);
vlc_object_lock( p_libvlc );
ARRAY_BSEARCH( priv->input_items,->i_id, int, p_input->i_id, i);
if( i != -1 )
ARRAY_REMOVE( priv->input_items, i);
vlc_object_unlock( p_libvlc );
free( p_input );
}
......@@ -489,23 +475,6 @@ int input_item_AddInfo( input_item_t *p_i,
return p_info->psz_value ? VLC_SUCCESS : VLC_ENOMEM;
}
input_item_t *__input_item_GetById( vlc_object_t *p_obj, int i_id )
{
libvlc_priv_t *priv = libvlc_priv (p_obj->p_libvlc);
input_item_t * p_ret = NULL;
int i;
vlc_object_lock( p_obj->p_libvlc );
ARRAY_BSEARCH( priv->input_items, ->i_id, int, i_id, i);
if( i != -1 )
p_ret = ARRAY_VAL( priv->input_items, i);
vlc_object_unlock( p_obj->p_libvlc );
return p_ret;
}
input_item_t *__input_item_NewExt( vlc_object_t *p_obj, const char *psz_uri,
const char *psz_name,
int i_options,
......@@ -531,12 +500,6 @@ input_item_t *input_item_NewWithType( vlc_object_t *p_obj, const char *psz_uri,
input_item_Init( p_obj, p_input );
vlc_gc_init( p_input, input_item_Destroy );
p_input->p_libvlc = p_obj->p_libvlc;
vlc_object_lock( p_obj->p_libvlc );
p_input->i_id = ++priv->i_last_input_id;
ARRAY_APPEND( priv->input_items, p_input );
vlc_object_unlock( p_obj->p_libvlc );
p_input->b_fixed_name = false;
......
......@@ -807,10 +807,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
vlc_mutex_init( &p_libvlc->p_stats->lock );
priv->p_stats_computer = NULL;
/* Init the array that holds every input item */
ARRAY_INIT( priv->input_items );
priv->i_last_input_id = 0;
/*
* Initialize hotkey handling
*/
......@@ -1077,15 +1073,6 @@ int libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
stats_TimersDumpAll( p_libvlc );
stats_TimersCleanAll( p_libvlc );
bool b_clean = true;
FOREACH_ARRAY( input_item_t *p_del, priv->input_items )
msg_Err( p_libvlc, "input item %p has not been deleted properly: name %s",
p_del, p_del->psz_name ? p_del->psz_name : "(null)" );
b_clean = false;
FOREACH_END();
assert( b_clean );
ARRAY_RESET( priv->input_items );
msg_Dbg( p_libvlc, "removing stats" );
vlc_mutex_destroy( &p_libvlc->p_stats->lock );
FREENULL( p_libvlc->p_stats );
......
......@@ -206,11 +206,6 @@ typedef struct libvlc_priv_t
vlc_mutex_t config_lock; ///< config file lock
char * psz_configfile; ///< location of config file
/* There is no real reason to keep a list of items, but not to break
* everything, let's keep it */
input_item_array_t input_items; ///< Array of all created input items
int i_last_input_id ; ///< Last id of input item
/* Messages */
msg_bank_t msg_bank; ///< The message bank
int i_verbose; ///< info messages
......
......@@ -160,7 +160,6 @@ input_item_AddOpt
input_item_AddOption
input_item_AddSubItem
input_item_CopyOptions
__input_item_GetById
input_item_GetDuration
input_item_GetInfo
input_item_GetMeta
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment