Commit dca6b1f8 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

Use vlc_atomic_t for input item ID

parent da9ea07c
......@@ -31,6 +31,7 @@
#include "vlc_playlist.h"
#include "vlc_interface.h"
#include <vlc_charset.h>
#include <vlc_atomic.h>
#include "item.h"
#include "info.h"
......@@ -844,8 +845,7 @@ input_item_t *input_item_NewWithType( vlc_object_t *p_obj, const char *psz_uri,
mtime_t i_duration,
int i_type )
{
libvlc_priv_t *priv = libvlc_priv (p_obj->p_libvlc);
static vlc_mutex_t input_id_lock = VLC_STATIC_MUTEX;
static vlc_atomic_t last_input_id = VLC_ATOMIC_INIT(0);
input_item_t* p_input = malloc( sizeof(input_item_t ) );
if( !p_input )
......@@ -854,9 +854,7 @@ 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 );
vlc_mutex_lock( &input_id_lock );
p_input->i_id = ++priv->i_last_input_id;
vlc_mutex_unlock( &input_id_lock );
p_input->i_id = vlc_atomic_inc(&last_input_id);
p_input->b_fixed_name = false;
......
......@@ -770,8 +770,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
priv->i_timers = 0;
priv->pp_timers = NULL;
priv->i_last_input_id = 0; /* Not very safe, should be removed */
/*
* Initialize hotkey handling
*/
......
......@@ -182,7 +182,6 @@ typedef struct libvlc_priv_t
{
libvlc_int_t public_data;
int i_last_input_id ; ///< Last id of input item
bool playlist_active;
/* Messages */
......
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