]> git.sesse.net Git - vlc/blobdiff - modules/access_output/bonjour.c
One more removing session. (useless test before a free())
[vlc] / modules / access_output / bonjour.c
index 34663d3d3d9b9a23f177fd72cf6fe566430f8019..908673e6f18c2638f56275fd5dc60a47d39795ee 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <stdlib.h>
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
 
 #include <vlc/vlc.h>
+#include "bonjour.h"
 
 #ifdef HAVE_AVAHI_CLIENT
-#include <vlc/intf.h>
-#include <vlc/sout.h>
+#include <vlc_sout.h>
 
 #include <avahi-client/client.h>
 #ifdef HAVE_AVAHI_06
@@ -190,8 +193,8 @@ static void poll_iterate_thread( poll_thread_t *p_pt )
 /*****************************************************************************
  * bonjour_start_service
  *****************************************************************************/
-void *bonjour_start_service( vlc_object_t *p_log, char *psz_stype,
-                            char *psz_name, int i_port, char *psz_txt )
+void *bonjour_start_service( vlc_object_t *p_log, const char *psz_stype,
+                             const char *psz_name, int i_port, char *psz_txt )
 {
     int err;
     bonjour_t *p_sys;
@@ -266,7 +269,7 @@ void *bonjour_start_service( vlc_object_t *p_log, char *psz_stype,
 
 error:
     if( p_sys->poll_thread != NULL )
-        vlc_object_destroy( p_sys->poll_thread );
+        vlc_object_release( p_sys->poll_thread );
     if( p_sys->client != NULL )
         avahi_client_free( p_sys->client );
     if( p_sys->simple_poll != NULL )
@@ -290,13 +293,9 @@ void bonjour_stop_service( void *_p_sys )
 {
     bonjour_t *p_sys = (bonjour_t *)_p_sys;
 
-    if( p_sys->poll_thread->b_thread )
-    {
-        p_sys->poll_thread->b_die = 1;
-        vlc_thread_join( p_sys->poll_thread );
-    }
-
-    vlc_object_destroy( p_sys->poll_thread );
+    vlc_object_kill( p_sys->poll_thread );
+    vlc_thread_join( p_sys->poll_thread );
+    vlc_object_release( p_sys->poll_thread );
 
     if( p_sys->group != NULL )
         avahi_entry_group_free( p_sys->group );