[vlc-devel] commit: Qt: try to fix #2430 (OpenUrl can crash). (Jean-Philippe Andre )
git version control
git at videolan.org
Sat Jan 24 15:30:36 CET 2009
vlc | branch: master | Jean-Philippe Andre <jpeg at via.ecp.fr> | Sat Jan 24 15:23:42 2009 +0100| [0c96a5b6baa9a3ac2d4b1231b1e3a9944fa5636c] | committer: Jean-Philippe Andre
Qt: try to fix #2430 (OpenUrl can crash).
+ Remove this->
+ Remove toNativeSeparators
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0c96a5b6baa9a3ac2d4b1231b1e3a9944fa5636c
---
modules/gui/qt4/dialogs/openurl.cpp | 20 +++++++++++---------
modules/gui/qt4/dialogs_provider.cpp | 5 ++---
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/modules/gui/qt4/dialogs/openurl.cpp b/modules/gui/qt4/dialogs/openurl.cpp
index 5fa3e7b..49a791b 100644
--- a/modules/gui/qt4/dialogs/openurl.cpp
+++ b/modules/gui/qt4/dialogs/openurl.cpp
@@ -38,6 +38,8 @@
#include <QFile>
#include <QLabel>
+#include <assert.h>
+
OpenUrlDialog *OpenUrlDialog::instance = NULL;
OpenUrlDialog* OpenUrlDialog::getInstance( QWidget *parent,
@@ -54,10 +56,10 @@ OpenUrlDialog* OpenUrlDialog::getInstance( QWidget *parent,
OpenUrlDialog::OpenUrlDialog( QWidget *parent,
intf_thread_t *_p_intf,
- bool bClipboard ) : QVLCDialog( parent, _p_intf )
+ bool _bClipboard ) :
+ QVLCDialog( parent, _p_intf ), bClipboard( _bClipboard )
{
- this->bClipboard = bClipboard;
- this->setWindowTitle( qtr( "Open URL" ) );
+ setWindowTitle( qtr( "Open URL" ) );
/* Buttons */
QPushButton *but;
@@ -78,9 +80,9 @@ OpenUrlDialog::OpenUrlDialog( QWidget *parent,
"to the media you want to play"),
this );
- this->setToolTip( qtr( "If your clipboard contains a valid URL\n"
- "or the path to a file on your computer,\n"
- "it will be automatically selected." ) );
+ setToolTip( qtr( "If your clipboard contains a valid URL\n"
+ "or the path to a file on your computer,\n"
+ "it will be automatically selected." ) );
/* Layout */
QVBoxLayout *vlay = new QVBoxLayout( this );
@@ -136,11 +138,11 @@ void OpenUrlDialog::showEvent( QShowEvent *ev )
if( bClipboard )
{
QClipboard *clipboard = QApplication::clipboard();
- const QMimeData *data = clipboard->mimeData( QClipboard::Selection );
- QString txt = data->text().trimmed();
+ assert( clipboard != NULL );
+ QString txt = clipboard->text( QClipboard::Selection ).trimmed();
if( txt.isEmpty() || ( !txt.contains("://") && !QFile::exists(txt) ) )
- txt = clipboard->mimeData()->text().trimmed();
+ txt = clipboard->text( QClipboard::Clipboard ).trimmed();
if( txt.contains( "://" ) || QFile::exists( txt ) )
edit->setText( txt );
diff --git a/modules/gui/qt4/dialogs_provider.cpp b/modules/gui/qt4/dialogs_provider.cpp
index 65bc820..dd67c06 100644
--- a/modules/gui/qt4/dialogs_provider.cpp
+++ b/modules/gui/qt4/dialogs_provider.cpp
@@ -438,13 +438,12 @@ void DialogsProvider::openUrlDialog()
QString url = oud->url();
if( !url.isEmpty() )
{
- playlist_Add( THEPL, qtu( toNativeSeparators( url ) ),
+ 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(
- toNativeSeparators( url ) );
+ RecentsMRL::getInstance( p_intf )->addRecent( url );
}
}
}
More information about the vlc-devel
mailing list