From 3485cfbe10b0e47a6ddbdf642cdcc94a0287c4cd Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Sat, 27 Sep 2008 12:25:44 +0300 Subject: [PATCH] Still allocate unique input item IDs --- src/input/item.c | 4 ++++ src/libvlc.c | 2 ++ src/libvlc.h | 2 ++ 3 files changed, 8 insertions(+) diff --git a/src/input/item.c b/src/input/item.c index 9f0634715b..8ce43c3133 100644 --- a/src/input/item.c +++ b/src/input/item.c @@ -501,6 +501,10 @@ 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_object_lock( p_obj->p_libvlc ); + p_input->i_id = ++priv->i_last_input_id; + vlc_object_unlock( p_obj->p_libvlc ); + p_input->b_fixed_name = false; if( psz_uri ) diff --git a/src/libvlc.c b/src/libvlc.c index 1f2f52a573..3c8df8f9c2 100644 --- a/src/libvlc.c +++ b/src/libvlc.c @@ -819,6 +819,8 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, vlc_mutex_init( &p_libvlc->p_stats->lock ); priv->p_stats_computer = NULL; + priv->i_last_input_id = 0; /* Not very safe, should be removed */ + /* * Initialize hotkey handling */ diff --git a/src/libvlc.h b/src/libvlc.h index 53d9dbd722..abc3aabec1 100644 --- a/src/libvlc.h +++ b/src/libvlc.h @@ -206,6 +206,8 @@ typedef struct libvlc_priv_t vlc_mutex_t config_lock; ///< config file lock char * psz_configfile; ///< location of config file + int i_last_input_id ; ///< Last id of input item + /* Messages */ msg_bank_t msg_bank; ///< The message bank int i_verbose; ///< info messages -- 2.39.2