[vlc-devel] commit: Compile fix after d228fdd28e (Christophe Mutricy )

Pierre d'Herbemont pdherbemont at free.fr
Sun Sep 28 01:24:35 CEST 2008


CurrentInput() retain the input... You'll have to remove the hold(),
and/or properly release the object when done.

Moreover CurrentInput() takes the PL_LOCK, so it would crash there.

On Sun, Sep 28, 2008 at 12:50 AM, git version control <git at videolan.org> wrote:
> vlc | branch: master | Christophe Mutricy <xtophe at videolan.org> | Sat Sep 27 23:49:37 2008 +0100| [c205ecf91771514fe967f52c986eeb94491b327e] | committer: Christophe Mutricy
>
> Compile fix after d228fdd28e
>
>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c205ecf91771514fe967f52c986eeb94491b327e
> ---
>
>  modules/control/dbus.c             |   26 ++++++++++++++------------
>  modules/misc/notify/notify.c       |    3 ++-
>  modules/misc/notify/telepathy.c    |    7 ++++---
>  modules/misc/notify/xosd.c         |    7 ++++---
>  modules/video_filter/atmo/atmo.cpp |    4 ++--
>  5 files changed, 26 insertions(+), 21 deletions(-)
>
> diff --git a/modules/control/dbus.c b/modules/control/dbus.c
> index 4873e87..6fc8cf3 100644
> --- a/modules/control/dbus.c
> +++ b/modules/control/dbus.c
> @@ -168,7 +168,7 @@ DBUS_METHOD( PositionGet )
>
>     playlist_t *p_playlist = pl_Hold( ((vlc_object_t*) p_this) );
>     PL_LOCK;
> -    input_thread_t *p_input = p_playlist->p_input;
> +    input_thread_t *p_input = playlist_CurrentInput( p_playlist );
>
>     if( !p_input )
>         i_pos = 0;
> @@ -207,7 +207,7 @@ DBUS_METHOD( PositionSet )
>     }
>     p_playlist = pl_Hold( ((vlc_object_t*) p_this) );
>     PL_LOCK;
> -    input_thread_t *p_input = p_playlist->p_input;
> +    input_thread_t *p_input = playlist_CurrentInput( p_playlist );
>
>     if( p_input )
>     {
> @@ -320,7 +320,7 @@ DBUS_METHOD( Play )
>     playlist_t *p_playlist = pl_Hold( (vlc_object_t*) p_this );
>
>     PL_LOCK;
> -    input_thread_t *p_input = p_playlist->p_input;
> +    input_thread_t *p_input =  playlist_CurrentInput( p_playlist );
>     if( p_input )
>         vlc_object_hold( p_input );
>     PL_UNLOCK;
> @@ -344,8 +344,9 @@ DBUS_METHOD( GetCurrentMetadata )
>     OUT_ARGUMENTS;
>     playlist_t* p_playlist = pl_Hold( (vlc_object_t*) p_this );
>     PL_LOCK;
> -    if( p_playlist->status.p_item )
> -        GetInputMeta( p_playlist->status.p_item->p_input, &args );
> +    playlist_item_t* p_item =  playlist_CurrentPlayingItem( p_playlist );
> +    if(  p_item )
> +        GetInputMeta( p_item->p_input, &args );
>     PL_UNLOCK;
>     pl_Release( (vlc_object_t*) p_this );
>     REPLY_SEND;
> @@ -804,7 +805,7 @@ static void Close   ( vlc_object_t *p_this )
>     var_DelCallback( p_playlist, "repeat", StatusChangeEmit, p_intf );
>     var_DelCallback( p_playlist, "loop", StatusChangeEmit, p_intf );
>
> -    p_input = p_playlist->p_input;
> +    p_input = playlist_CurrentInput( p_playlist );
>     if ( p_input )
>     {
>         vlc_object_hold( p_input );
> @@ -997,7 +998,7 @@ static int TrackChange( vlc_object_t *p_this, const char *psz_var,
>     p_sys->b_meta_read = false;
>
>     p_playlist = pl_Hold( p_intf );
> -    p_input = p_playlist->p_input;
> +    p_input = playlist_CurrentInput( p_playlist );
>
>     if( !p_input )
>     {
> @@ -1040,14 +1041,15 @@ 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( p_playlist->p_input )
> +
> +    input_thread_t* p_input = playlist_CurrentInput( p_playlist );
> +    if( p_input )
>     {
>         /* XXX: if UpdateCaps() is called too early, these are
>          * unconditionnaly true */
> -        if( var_GetBool( p_playlist->p_input, "can-pause" ) )
> +        if( var_GetBool( p_input, "can-pause" ) )
>             i_caps |= CAPS_CAN_PAUSE;
> -        if( var_GetBool( p_playlist->p_input, "seekable" ) )
> +        if( var_GetBool( p_input, "seekable" ) )
>             i_caps |= CAPS_CAN_SEEK;
>     }
>
> @@ -1166,7 +1168,7 @@ static int MarshalStatus( intf_thread_t* p_intf, DBusMessageIter* args,
>
>     i_state = 2;
>
> -    p_input = p_playlist->p_input;
> +    p_input = playlist_CurrentInput( p_playlist );
>     if( p_input )
>     {
>         var_Get( p_input, "state", &val );
> diff --git a/modules/misc/notify/notify.c b/modules/misc/notify/notify.c
> index 5fc7bd6..879e8cf 100644
> --- a/modules/misc/notify/notify.c
> +++ b/modules/misc/notify/notify.c
> @@ -144,7 +144,8 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
>     char                *psz_artist     = NULL;
>     char                *psz_album      = NULL;
>     char                *psz_arturl     = NULL;
> -    input_thread_t      *p_input        = ((playlist_t*) p_this)->p_input;
> +    input_thread_t      *p_input        =  playlist_CurrentInput(
> +                                                    (playlist_t*) p_this );
>     intf_thread_t       *p_intf         = ( intf_thread_t* ) param;
>     intf_sys_t          *p_sys          = p_intf->p_sys;
>
> diff --git a/modules/misc/notify/telepathy.c b/modules/misc/notify/telepathy.c
> index 91950fa..ffbcd4c 100644
> --- a/modules/misc/notify/telepathy.c
> +++ b/modules/misc/notify/telepathy.c
> @@ -137,12 +137,13 @@ static void Close( vlc_object_t *p_this )
>  {
>     intf_thread_t *p_intf = (intf_thread_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_playlist->p_input )
> -        var_DelCallback( p_playlist->p_input, "state", StateChange, p_intf );
> +    if( (p_input = playlist_CurrentInput( p_playlist )) )
> +        var_DelCallback( p_input, "state", StateChange, p_intf );
>     PL_UNLOCK;
>     pl_Release( p_this );
>
> @@ -190,7 +191,7 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
>         p_intf->p_sys->i_item_changes++;
>     }
>
> -    p_input = p_playlist->p_input;
> +    p_input = playlist_CurrentInput( p_playlist );
>
>     if( !p_input ) return VLC_SUCCESS;
>     vlc_object_hold( p_input );
> diff --git a/modules/misc/notify/xosd.c b/modules/misc/notify/xosd.c
> index b8bd21c..dd5dbc6 100644
> --- a/modules/misc/notify/xosd.c
> +++ b/modules/misc/notify/xosd.c
> @@ -234,19 +234,20 @@ static void Run( intf_thread_t *p_intf )
>             }
>             free( psz_display );
>             psz_display = NULL;
> -            if( p_playlist->status.i_status == PLAYLIST_STOPPED )
> +            int i_status = playlist_Status( p_playlist );
> +            if( i_status == PLAYLIST_STOPPED )
>             {
>                 psz_display = strdup(_("Stop"));
>                 pl_Release( p_intf );
>             }
> -            else if( p_playlist->status.i_status == PLAYLIST_PAUSED )
> +            else if( i_status == PLAYLIST_PAUSED )
>             {
>                 psz_display = strdup(_("Pause"));
>                 pl_Release( p_intf );
>             }
>             else
>             {
> -                p_item = p_playlist->status.p_item;
> +                p_item = playlist_CurrentPlayingItem( p_playlist );
>                 p_input = p_item->p_input;
>
>                 pl_Release( p_intf );
> diff --git a/modules/video_filter/atmo/atmo.cpp b/modules/video_filter/atmo/atmo.cpp
> index 08fe4ef..1b5328f 100644
> --- a/modules/video_filter/atmo/atmo.cpp
> +++ b/modules/video_filter/atmo/atmo.cpp
> @@ -1930,7 +1930,7 @@ static int StateCallback( vlc_object_t *p_this, char const *psz_cmd,
>  static void AddStateVariableCallback(filter_t *p_filter)
>  {
>     playlist_t *p_playlist = pl_Hold( p_filter );
> -    input_thread_t *p_input = p_playlist->p_input;
> +    input_thread_t *p_input = playlist_CurrentInput( p_playlist );
>     if(p_input)
>     {
>         var_AddCallback( p_input, "state", StateCallback, p_filter );
> @@ -1948,7 +1948,7 @@ static void AddStateVariableCallback(filter_t *p_filter)
>  static void DelStateVariableCallback( filter_t *p_filter )
>  {
>     playlist_t *p_playlist = pl_Hold( p_filter );
> -    input_thread_t *p_input = p_playlist->p_input;
> +    input_thread_t *p_input = playlist_CurrentInput( p_playlist );
>     if(p_input)
>     {
>         var_DelCallback( p_input, "state", StateCallback, p_filter );
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel
>
>



More information about the vlc-devel mailing list