Commit b7be4a3a authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

ImportController: Fixing potential crash when reopening the window

parent fc7b6b06
...@@ -43,7 +43,9 @@ ImportController::ImportController(QWidget *parent) : ...@@ -43,7 +43,9 @@ ImportController::ImportController(QWidget *parent) :
m_nbMediaLoaded( 0 ) m_nbMediaLoaded( 0 )
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
m_preview = new PreviewWidget( new ClipRenderer, m_ui->previewContainer ); //The renderer will be deleted by the PreviewWidget
m_clipRenderer = new ClipRenderer;
m_preview = new PreviewWidget( m_clipRenderer, m_ui->previewContainer );
m_stackNav = new StackViewController( m_ui->stackViewContainer ); m_stackNav = new StackViewController( m_ui->stackViewContainer );
m_temporaryMedias = new MediaContainer; m_temporaryMedias = new MediaContainer;
m_mediaListView = new MediaListView( m_stackNav, m_temporaryMedias ); m_mediaListView = new MediaListView( m_stackNav, m_temporaryMedias );
...@@ -87,13 +89,11 @@ ImportController::ImportController(QWidget *parent) : ...@@ -87,13 +89,11 @@ ImportController::ImportController(QWidget *parent) :
this, SLOT( forwardButtonClicked() ) ); this, SLOT( forwardButtonClicked() ) );
connect( this, SIGNAL( clipSelected( Clip* ) ), connect( this, SIGNAL( clipSelected( Clip* ) ),
qobject_cast<const ClipRenderer*>( m_preview->getGenericRenderer() ), m_clipRenderer, SLOT( setClip( Clip* ) ) );
SLOT( setClip( Clip* ) ) );
connect( m_mediaListView, SIGNAL( clipSelected( Clip* ) ), connect( m_mediaListView, SIGNAL( clipSelected( Clip* ) ),
this, SLOT( clipSelection( Clip* ) ) ); this, SLOT( clipSelection( Clip* ) ) );
connect( m_mediaListView, SIGNAL( clipDeleted( const QUuid& ) ), connect( m_mediaListView, SIGNAL( clipDeleted( const QUuid& ) ),
qobject_cast<const ClipRenderer*>( m_preview->getGenericRenderer() ), m_clipRenderer, SLOT( clipUnloaded( const QUuid& ) ) );
SLOT( clipUnloaded( const QUuid& ) ) );
connect( MetaDataManager::getInstance(), SIGNAL( failedToCompute( Media* ) ), connect( MetaDataManager::getInstance(), SIGNAL( failedToCompute( Media* ) ),
this, SLOT( failedToLoad( Media* ) ) ); this, SLOT( failedToLoad( Media* ) ) );
...@@ -239,6 +239,7 @@ ImportController::reject() ...@@ -239,6 +239,7 @@ ImportController::reject()
m_mediaListView->clear(); m_mediaListView->clear();
m_temporaryMedias->clear(); m_temporaryMedias->clear();
collapseAllButCurrentPath(); collapseAllButCurrentPath();
m_clipRenderer->setClip( NULL );
done( Rejected ); done( Rejected );
} }
...@@ -251,6 +252,7 @@ ImportController::accept() ...@@ -251,6 +252,7 @@ ImportController::accept()
foreach ( Clip* clip, m_temporaryMedias->clips().values() ) foreach ( Clip* clip, m_temporaryMedias->clips().values() )
Library::getInstance()->addMedia( clip->getMedia() ); Library::getInstance()->addMedia( clip->getMedia() );
m_temporaryMedias->removeAll(); m_temporaryMedias->removeAll();
m_clipRenderer->setClip( NULL );
done( Accepted ); done( Accepted );
} }
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <QFileSystemModel> #include <QFileSystemModel>
#include <QProgressDialog> #include <QProgressDialog>
class ClipRenderer;
class MediaContainer; class MediaContainer;
class MediaListView; class MediaListView;
...@@ -81,6 +82,7 @@ class ImportController : public QDialog ...@@ -81,6 +82,7 @@ class ImportController : public QDialog
MediaContainer *m_temporaryMedias; MediaContainer *m_temporaryMedias;
quint32 m_nbMediaToLoad; quint32 m_nbMediaToLoad;
quint32 m_nbMediaLoaded; quint32 m_nbMediaLoaded;
ClipRenderer* m_clipRenderer;
public slots: public slots:
void accept(); void accept();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment