[vlc-devel] commit: Fix playlist_CurrentInput usage. (Pierre d'Herbemont )
git version control
git at videolan.org
Sun Sep 28 02:05:32 CEST 2008
vlc | branch: master | Pierre d'Herbemont <pdherbemont at videolan.org> | Sun Sep 28 02:08:39 2008 +0200| [47fd5024be5edf4ef7f85d56482d17bc598766e3] | committer: Pierre d'Herbemont
Fix playlist_CurrentInput usage.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=47fd5024be5edf4ef7f85d56482d17bc598766e3
---
modules/control/dbus.c | 26 ++++++--------------------
modules/gui/skins2/src/vlcproc.cpp | 8 ++++----
modules/misc/notify/notify.c | 1 -
modules/misc/notify/telepathy.c | 6 +++---
modules/video_filter/atmo/atmo.cpp | 6 ++++--
5 files changed, 17 insertions(+), 30 deletions(-)
diff --git a/modules/control/dbus.c b/modules/control/dbus.c
index 6fc8cf3..3968742 100644
--- a/modules/control/dbus.c
+++ b/modules/control/dbus.c
@@ -167,7 +167,6 @@ DBUS_METHOD( PositionGet )
dbus_int32_t i_pos;
playlist_t *p_playlist = pl_Hold( ((vlc_object_t*) p_this) );
- PL_LOCK;
input_thread_t *p_input = playlist_CurrentInput( p_playlist );
if( !p_input )
@@ -176,8 +175,8 @@ DBUS_METHOD( PositionGet )
{
var_Get( p_input, "time", &position );
i_pos = position.i_time / 1000;
+ vlc_object_release( p_input );
}
- PL_UNLOCK;
pl_Release( ((vlc_object_t*) p_this) );
ADD_INT32( &i_pos );
REPLY_SEND;
@@ -206,15 +205,14 @@ DBUS_METHOD( PositionSet )
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
p_playlist = pl_Hold( ((vlc_object_t*) p_this) );
- PL_LOCK;
input_thread_t *p_input = playlist_CurrentInput( p_playlist );
if( p_input )
{
position.i_time = i_pos * 1000;
var_Set( p_input, "time", position );
+ vlc_object_release( p_input );
}
- PL_UNLOCK;
pl_Release( ((vlc_object_t*) p_this) );
REPLY_SEND;
}
@@ -319,11 +317,7 @@ DBUS_METHOD( Play )
REPLY_INIT;
playlist_t *p_playlist = pl_Hold( (vlc_object_t*) p_this );
- PL_LOCK;
input_thread_t *p_input = playlist_CurrentInput( p_playlist );
- if( p_input )
- vlc_object_hold( p_input );
- PL_UNLOCK;
if( p_input )
{
@@ -796,7 +790,6 @@ static void Close ( vlc_object_t *p_this )
playlist_t *p_playlist = pl_Hold( p_intf );;
input_thread_t *p_input;
- PL_LOCK;
var_DelCallback( p_playlist, "playlist-current", TrackChange, p_intf );
var_DelCallback( p_playlist, "intf-change", TrackListChangeEmit, p_intf );
var_DelCallback( p_playlist, "item-append", TrackListChangeEmit, p_intf );
@@ -808,12 +801,10 @@ static void Close ( vlc_object_t *p_this )
p_input = playlist_CurrentInput( p_playlist );
if ( p_input )
{
- vlc_object_hold( p_input );
var_DelCallback( p_input, "state", StateChange, p_intf );
vlc_object_release( p_input );
}
- PL_UNLOCK;
pl_Release( p_intf );
dbus_connection_unref( p_intf->p_sys->p_conn );
@@ -999,15 +990,12 @@ static int TrackChange( vlc_object_t *p_this, const char *psz_var,
p_playlist = pl_Hold( p_intf );
p_input = playlist_CurrentInput( p_playlist );
-
if( !p_input )
{
- PL_UNLOCK;
pl_Release( p_intf );
return VLC_SUCCESS;
}
- vlc_object_hold( p_input );
pl_Release( p_intf );
p_item = input_GetItem( p_input );
@@ -1041,7 +1029,8 @@ static int UpdateCaps( intf_thread_t* p_intf, bool b_playlist_locked )
if( p_playlist->current.i_size > 0 )
i_caps |= CAPS_CAN_PLAY | CAPS_CAN_GO_PREV | CAPS_CAN_GO_NEXT;
-
+ if( !b_playlist_locked ) PL_UNLOCK;
+
input_thread_t* p_input = playlist_CurrentInput( p_playlist );
if( p_input )
{
@@ -1051,9 +1040,9 @@ static int UpdateCaps( intf_thread_t* p_intf, bool b_playlist_locked )
i_caps |= CAPS_CAN_PAUSE;
if( var_GetBool( p_input, "seekable" ) )
i_caps |= CAPS_CAN_SEEK;
+ vlc_object_release( p_input );
}
- if( !b_playlist_locked ) PL_UNLOCK;
pl_Release( p_intf );
if( p_sys->b_meta_read )
@@ -1163,8 +1152,6 @@ static int MarshalStatus( intf_thread_t* p_intf, DBusMessageIter* args,
input_thread_t* p_input = NULL;
p_playlist = pl_Hold( p_intf );
- if( lock )
- PL_LOCK;
i_state = 2;
@@ -1178,6 +1165,7 @@ static int MarshalStatus( intf_thread_t* p_intf, DBusMessageIter* args,
i_state = 1;
else if( val.i_int <= PLAYING_S )
i_state = 0;
+ vlc_object_release( p_input );
}
i_random = var_CreateGetBool( p_playlist, "random" );
@@ -1186,8 +1174,6 @@ static int MarshalStatus( intf_thread_t* p_intf, DBusMessageIter* args,
i_loop = var_CreateGetBool( p_playlist, "loop" );
- if( lock )
- PL_UNLOCK;
pl_Release( p_intf );
dbus_message_iter_open_container( args, DBUS_TYPE_STRUCT, NULL, &status );
diff --git a/modules/gui/skins2/src/vlcproc.cpp b/modules/gui/skins2/src/vlcproc.cpp
index 5eef52c..32d3c7d 100644
--- a/modules/gui/skins2/src/vlcproc.cpp
+++ b/modules/gui/skins2/src/vlcproc.cpp
@@ -330,8 +330,6 @@ void VlcProc::refreshInput()
{
getIntf()->p_sys->p_input =
playlist_CurrentInput( getIntf()->p_sys->p_playlist );
- if( getIntf()->p_sys->p_input )
- vlc_object_hold( getIntf()->p_sys->p_input );
}
else if( getIntf()->p_sys->p_input->b_dead )
{
@@ -561,10 +559,11 @@ int VlcProc::onInteraction( vlc_object_t *pObj, const char *pVariable,
void VlcProc::updateStreamName( playlist_t *p_playlist )
{
- if( p_playlist && playlist_CurrentInput( p_playlist ))
+ if( p_playlist )
{
+ input_thread_t * p_input = playlist_CurrentInput( p_playlist )
// Get playlist item information
- input_item_t *pItem = input_GetItem(playlist_CurrentInput( p_playlist));
+ input_item_t *pItem = input_GetItem( p_input );
VarText &rStreamName = getStreamNameVar();
VarText &rStreamURI = getStreamURIVar();
@@ -589,6 +588,7 @@ void VlcProc::updateStreamName( playlist_t *p_playlist )
AsyncQueue *pQueue = AsyncQueue::instance( getIntf() );
pQueue->push( CmdGenericPtr( pCmd1 ), false );
pQueue->push( CmdGenericPtr( pCmd2 ), false );
+ vlc_object_release( p_input );
}
}
diff --git a/modules/misc/notify/notify.c b/modules/misc/notify/notify.c
index 879e8cf..8879b08 100644
--- a/modules/misc/notify/notify.c
+++ b/modules/misc/notify/notify.c
@@ -150,7 +150,6 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
intf_sys_t *p_sys = p_intf->p_sys;
if( !p_input ) return VLC_SUCCESS;
- vlc_object_hold( p_input );
if( p_input->b_dead )
{
diff --git a/modules/misc/notify/telepathy.c b/modules/misc/notify/telepathy.c
index ffbcd4c..0795bb6 100644
--- a/modules/misc/notify/telepathy.c
+++ b/modules/misc/notify/telepathy.c
@@ -139,12 +139,13 @@ static void Close( vlc_object_t *p_this )
playlist_t *p_playlist = pl_Hold( p_this );
input_thread_t *p_input = NULL;
- PL_LOCK;
var_DelCallback( p_playlist, "item-change", ItemChange, p_intf );
var_DelCallback( p_playlist, "playlist-current", ItemChange, p_intf );
if( (p_input = playlist_CurrentInput( p_playlist )) )
+ {
var_DelCallback( p_input, "state", StateChange, p_intf );
- PL_UNLOCK;
+ vlc_object_release( p_input );
+ }
pl_Release( p_this );
/* Clears the Presence message ... else it looks like we're still playing
@@ -194,7 +195,6 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
p_input = playlist_CurrentInput( p_playlist );
if( !p_input ) return VLC_SUCCESS;
- vlc_object_hold( p_input );
if( p_input->b_dead || !input_GetItem(p_input)->psz_name )
{
diff --git a/modules/video_filter/atmo/atmo.cpp b/modules/video_filter/atmo/atmo.cpp
index 1b5328f..a2a1655 100644
--- a/modules/video_filter/atmo/atmo.cpp
+++ b/modules/video_filter/atmo/atmo.cpp
@@ -1934,8 +1934,9 @@ static void AddStateVariableCallback(filter_t *p_filter)
if(p_input)
{
var_AddCallback( p_input, "state", StateCallback, p_filter );
+ vlc_object_release( p_input );
}
- vlc_object_release( p_playlist );
+ pl_Release( p_filter );
}
/*****************************************************************************
@@ -1952,8 +1953,9 @@ static void DelStateVariableCallback( filter_t *p_filter )
if(p_input)
{
var_DelCallback( p_input, "state", StateCallback, p_filter );
+ vlc_object_release( p_input );
}
- vlc_object_release( p_playlist );
+ pl_Release( p_filter );
}
More information about the vlc-devel
mailing list