]> git.sesse.net Git - vlc/blobdiff - modules/services_discovery/upnp_cc.cpp
playlist: Don't allow pl_Release(p_playlist) and pl_Yield(p_playlist).
[vlc] / modules / services_discovery / upnp_cc.cpp
index cd6e7fd48636d20fbe17ddd0766c5e55d224734b..91bec309b29de85bf476278a1a47c17014987484 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Authors: RĂ©mi Denis-Courmont <rem # videolan.org>
  *
- * Based on original wxWindows patch for VLC, and dependant on CyberLink
+ * Based on original wxWindows patch for VLC, and dependent on CyberLink
  * UPnP library from :
  *          Satoshi Konno <skonno@cybergarage.org>
  *
 #include <cybergarage/upnp/media/player/MediaPlayer.h>
 
 #undef PACKAGE_NAME
-#include <vlc/vlc.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_playlist.h>
 
 /* FIXME: thread-safety ?? */
@@ -54,7 +59,7 @@ using namespace CyberLink;
 
 vlc_module_begin();
     set_shortname( "UPnP");
-    set_description( _("Universal Plug'n'Play discovery") );
+    set_description( N_("Universal Plug'n'Play discovery") );
     set_category( CAT_PLAYLIST );
     set_subcategory( SUBCAT_PLAYLIST_SD );
 
@@ -151,7 +156,7 @@ static void Run( services_discovery_t *p_sd )
 
     msg_Dbg( p_sd, "UPnP discovery started" );
     /* read SAP packets */
-    while( !p_sd->b_die )
+    while( vlc_object_alive (p_sd) )
     {
         msleep( 500 );
     }
@@ -213,9 +218,11 @@ void UPnPHandler::AddContent( playlist_item_t *p_parent, ContentNode *node )
     {
         ItemNode *iNode = (ItemNode *)node;
         input_item_t *p_input = input_ItemNew( p_sd, iNode->getResource(), title );
+        /* FIXME: playlist_AddInput() can fail */
         playlist_BothAddInput( p_playlist, p_input, p_parent,
                                PLAYLIST_APPEND, PLAYLIST_END, NULL, NULL,
-                               VLC_FALSE );
+                               false );
+        vlc_gc_decref( p_input );
     } else if ( node->isContainerNode() )
     {
         ContainerNode *conNode = (ContainerNode *)node;
@@ -238,7 +245,7 @@ void UPnPHandler::RemoveDevice( Device *dev )
     playlist_item_t *p_item = FindDeviceNode( dev );
 
     if( p_item != NULL )
-        playlist_NodeDelete( p_playlist, p_item, VLC_TRUE, VLC_TRUE );
+        playlist_NodeDelete( p_playlist, p_item, true, true );
 }