[vlc-devel] commit: Remove services discovery tasks before the playlist ( Rémi Denis-Courmont )
git version control
git at videolan.org
Thu Jun 12 20:59:25 CEST 2008
vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Thu Jun 12 22:01:16 2008 +0300| [bd054d30866ab0144e0b0582e249184a8ea6506f]
Remove services discovery tasks before the playlist
I assume nothing can ever try to add a new one once the interfaces have
been destroyed. If not there is a race condition.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bd054d30866ab0144e0b0582e249184a8ea6506f
---
src/libvlc.c | 4 ++++
src/libvlc.h | 2 ++
src/playlist/engine.c | 8 ++------
src/playlist/services_discovery.c | 7 +++++++
4 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/src/libvlc.c b/src/libvlc.c
index 9c60cab..24e3913 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -950,6 +950,10 @@ int libvlc_InternalCleanup( libvlc_int_t *p_libvlc )
}
#endif
+ /* Remove all services discovery */
+ msg_Dbg( p_libvlc, "removing all services discovery tasks" );
+ playlist_ServicesDiscoveryKillAll( priv->p_playlist );
+
/* Free playlist */
msg_Dbg( p_libvlc, "removing playlist" );
vlc_object_release( priv->p_playlist );
diff --git a/src/libvlc.h b/src/libvlc.h
index 936b75c..0964abd 100644
--- a/src/libvlc.h
+++ b/src/libvlc.h
@@ -247,6 +247,8 @@ static inline libvlc_priv_t *libvlc_priv (libvlc_int_t *libvlc)
return (libvlc_priv_t *)(libvlc + 1);
}
+void playlist_ServicesDiscoveryKillAll( playlist_t *p_playlist );
+
#define libvlc_stats( o ) (libvlc_priv((VLC_OBJECT(o))->p_libvlc)->b_stats)
/**
diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index 3ee5cb7..94dda74 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -419,12 +419,8 @@ void playlist_LastLoop( playlist_t *p_playlist )
sout_DeleteInstance( p_sout );
#endif
- while( p_playlist->i_sds )
- {
- playlist_ServicesDiscoveryRemove( p_playlist,
- p_playlist->pp_sds[0]->p_sd->psz_module );
- }
-
+ /* Core should have terminated all SDs before the playlist */
+ assert( p_playlist->i_sds == 0 );
playlist_MLDump( p_playlist );
PL_LOCK;
diff --git a/src/playlist/services_discovery.c b/src/playlist/services_discovery.c
index 6f3cda6..4fb9ea3 100644
--- a/src/playlist/services_discovery.c
+++ b/src/playlist/services_discovery.c
@@ -430,3 +430,10 @@ bool playlist_IsServicesDiscoveryLoaded( playlist_t * p_playlist,
return false;
}
+void playlist_ServicesDiscoveryKillAll( playlist_t *p_playlist )
+{
+ while( p_playlist->i_sds > 0 )
+ playlist_ServicesDiscoveryRemove( p_playlist,
+ p_playlist->pp_sds[0]->p_sd->psz_module );
+}
+
More information about the vlc-devel
mailing list