[vlmc-devel] commit: Import: Fixing crash when trying to import an already imported media. ( Hugo Beauzee-Luyssen )

git at videolan.org git at videolan.org
Wed Mar 17 00:05:59 CET 2010


vlmc | branch: master | Hugo Beauzee-Luyssen <beauze.h at gmail.com> | Tue Mar 16 23:59:39 2010 +0100| [6a7ff6547aa3a189138ac4d5fe057e102c3bb1da] | committer: Hugo Beauzee-Luyssen 

Import: Fixing crash when trying to import an already imported media.

The existance check was broken.

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=6a7ff6547aa3a189138ac4d5fe057e102c3bb1da
---

 src/Gui/import/ImportController.cpp |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/Gui/import/ImportController.cpp b/src/Gui/import/ImportController.cpp
index 6cfa004..37184a9 100644
--- a/src/Gui/import/ImportController.cpp
+++ b/src/Gui/import/ImportController.cpp
@@ -170,18 +170,23 @@ ImportController::setUIMetaData( const Clip* clip )
 void
 ImportController::importMedia( const QString &filePath )
 {
-    if ( Library::getInstance()->mediaAlreadyLoaded( filePath ) == true )
+    if ( Library::getInstance()->mediaAlreadyLoaded( filePath ) == true ||
+         m_temporaryMedias->mediaAlreadyLoaded( filePath ) == true )
         return ;
-    ++m_nbMediaToLoad;
-    m_ui->progressBar->setMaximum( m_nbMediaToLoad );
 
     Media*  media = m_temporaryMedias->addMedia( filePath );
+    if ( media == NULL )
+    {
+        qCritical() << "An error occured while loading media:" << filePath;
+        return ;
+    }
     Clip*   clip = new Clip( media );
     media->setBaseClip( clip );
     m_temporaryMedias->addClip( clip );
-    if ( media )
-        connect( media, SIGNAL( metaDataComputed( const Media* ) ),
-                 this, SLOT( metaDataComputed( const Media* ) ) );
+    ++m_nbMediaToLoad;
+    m_ui->progressBar->setMaximum( m_nbMediaToLoad );
+    connect( media, SIGNAL( metaDataComputed( const Media* ) ),
+             this, SLOT( metaDataComputed( const Media* ) ) );
 }
 
 void



More information about the Vlmc-devel mailing list