[vlc-commits] Qt4: ensure to give a valid URI to the playlist

Ludovic Fauvet git at videolan.org
Thu Oct 13 17:50:01 CEST 2011


vlc | branch: master | Ludovic Fauvet <etix at videolan.org> | Thu Oct 13 14:33:30 2011 +0200| [f53bb2ebf566b138d5eb1eb34ca2ed641cb06062] | committer: Jean-Baptiste Kempf

Qt4: ensure to give a valid URI to the playlist

The URI is only given to the core while the original mrl is kept for the
display.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f53bb2ebf566b138d5eb1eb34ca2ed641cb06062
---

 modules/gui/qt4/dialogs_provider.cpp |   24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/modules/gui/qt4/dialogs_provider.cpp b/modules/gui/qt4/dialogs_provider.cpp
index 6905c42..d28bf31 100644
--- a/modules/gui/qt4/dialogs_provider.cpp
+++ b/modules/gui/qt4/dialogs_provider.cpp
@@ -474,12 +474,17 @@ void DialogsProvider::openUrlDialog()
         QString url = oud->url();
         if( !url.isEmpty() )
         {
-            playlist_Add( THEPL, qtu( url ),
-                          NULL, !oud->shouldEnqueue() ?
-                                  ( PLAYLIST_APPEND | PLAYLIST_GO )
-                                : ( PLAYLIST_APPEND | PLAYLIST_PREPARSE ),
-                          PLAYLIST_END, true, false );
-            RecentsMRL::getInstance( p_intf )->addRecent( url );
+            char *uri = make_URI( qtu( url ), NULL );
+            if( likely( uri != NULL ) )
+            {
+                playlist_Add( THEPL, uri,
+                              NULL, !oud->shouldEnqueue() ?
+                                      ( PLAYLIST_APPEND | PLAYLIST_GO )
+                                    : ( PLAYLIST_APPEND | PLAYLIST_PREPARSE ),
+                              PLAYLIST_END, true, false );
+                RecentsMRL::getInstance( p_intf )->addRecent( url );
+                free( uri );
+            }
         }
     }
     delete oud;
@@ -739,7 +744,12 @@ void DialogsProvider::SDMenuAction( const QString& data )
  **/
 void DialogsProvider::playMRL( const QString &mrl )
 {
-    playlist_Add( THEPL, qtu(mrl), NULL,
+    char *uri = make_URI( qtu( mrl ), NULL );
+    if( unlikely( uri == NULL ) )
+        return;
+
+    playlist_Add( THEPL, uri, NULL,
            PLAYLIST_APPEND | PLAYLIST_GO , PLAYLIST_END, true, false );
     RecentsMRL::getInstance( p_intf )->addRecent( mrl );
+    free( uri );
 }



More information about the vlc-commits mailing list