Changeset 89e10b6c29b7b18ad251b2f55da95a961d54a554

Show
Ignore:
Timestamp:
07/05/08 16:29:04 (2 months ago)
Author:
Rémi Denis-Courmont <rdenis@simphalempin.com>
git-committer:
Rémi Denis-Courmont <rdenis@simphalempin.com> 1215268144 +0300
git-parent:

[69022122e6df8208d33a5809674e1f6b9bd4bcbb]

git-author:
Rémi Denis-Courmont <rdenis@simphalempin.com> 1215268144 +0300
Message:

pl_Yield(): return NULL when the playlist is gone (or going)

This allows using pl_Yield() from video outputs and friends, on
condition that pl_Yield() return value be checked for NULLity.

Should fix #1667.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/libvlc.c

    r6902212 r89e10b6  
    955955#endif 
    956956 
     957    playlist_t *p_playlist = priv->p_playlist; 
    957958    /* Remove all services discovery */ 
    958959    msg_Dbg( p_libvlc, "removing all services discovery tasks" ); 
    959     playlist_ServicesDiscoveryKillAll( priv->p_playlist ); 
     960    playlist_ServicesDiscoveryKillAll( p_playlist ); 
    960961 
    961962    /* Free playlist */ 
     963    /* Any thread still running must not assume pl_Yield() succeeds. */ 
    962964    msg_Dbg( p_libvlc, "removing playlist" ); 
    963     vlc_object_kill( priv->p_playlist ); 
    964     vlc_thread_join( priv->p_playlist ); 
    965     vlc_object_release( priv->p_playlist ); 
     965    priv->p_playlist = NULL; 
     966    vlc_object_kill( p_playlist ); /* <-- memory barrier for pl_Yield() */ 
     967    vlc_thread_join( p_playlist ); 
     968    vlc_object_release( p_playlist ); 
    966969 
    967970    /* Free interaction */ 
  • src/playlist/control.c

    r23d1d36 r89e10b6  
    4444playlist_t *__pl_Yield( vlc_object_t *p_this ) 
    4545{ 
    46     playlist_t *pl = libvlc_priv (p_this->p_libvlc)->p_playlist; 
    47     /* Objects that are destroyed _after_ the playlist cannot use pl_Yield() */ 
    48     assert (p_this->i_object_type != VLC_OBJECT_VOUT); 
    49     assert (p_this->i_object_type != VLC_OBJECT_ANNOUNCE); 
    50     assert ((void *)p_this != libvlc_priv (p_this->p_libvlc)->p_interaction); 
    51  
    52     assert( pl != NULL ); 
    53     vlc_object_yield( pl ); 
     46    playlist_t *pl; 
     47 
     48    barrier (); 
     49    pl = libvlc_priv (p_this->p_libvlc)->p_playlist; 
     50    if (pl) 
     51        vlc_object_yield (pl); 
    5452    return pl; 
    5553} 
  • src/playlist/engine.c

    rd90d8b7 r89e10b6  
    174174    if( p_playlist->p_fetcher ) 
    175175        vlc_object_release( p_playlist->p_fetcher ); 
    176 #ifndef NDEBUG 
    177     libvlc_priv (p_this->p_libvlc)->p_playlist = NULL; /* pl_Yield() will fail */ 
    178 #endif 
    179176} 
    180177