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) :
m_nbMediaLoaded( 0 )
{
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_temporaryMedias = new MediaContainer;
m_mediaListView = new MediaListView( m_stackNav, m_temporaryMedias );
......@@ -87,13 +89,11 @@ ImportController::ImportController(QWidget *parent) :
this, SLOT( forwardButtonClicked() ) );
connect( this, SIGNAL( clipSelected( Clip* ) ),
qobject_cast<const ClipRenderer*>( m_preview->getGenericRenderer() ),
SLOT( setClip( Clip* ) ) );
m_clipRenderer, SLOT( setClip( Clip* ) ) );
connect( m_mediaListView, SIGNAL( clipSelected( Clip* ) ),
this, SLOT( clipSelection( Clip* ) ) );
connect( m_mediaListView, SIGNAL( clipDeleted( const QUuid& ) ),
qobject_cast<const ClipRenderer*>( m_preview->getGenericRenderer() ),
SLOT( clipUnloaded( const QUuid& ) ) );
m_clipRenderer, SLOT( clipUnloaded( const QUuid& ) ) );
connect( MetaDataManager::getInstance(), SIGNAL( failedToCompute( Media* ) ),
this, SLOT( failedToLoad( Media* ) ) );
......@@ -239,6 +239,7 @@ ImportController::reject()
m_mediaListView->clear();
m_temporaryMedias->clear();
collapseAllButCurrentPath();
m_clipRenderer->setClip( NULL );
done( Rejected );
}
......@@ -251,6 +252,7 @@ ImportController::accept()
foreach ( Clip* clip, m_temporaryMedias->clips().values() )
Library::getInstance()->addMedia( clip->getMedia() );
m_temporaryMedias->removeAll();
m_clipRenderer->setClip( NULL );
done( Accepted );
}
......
......@@ -40,6 +40,7 @@
#include <QFileSystemModel>
#include <QProgressDialog>
class ClipRenderer;
class MediaContainer;
class MediaListView;
......@@ -81,6 +82,7 @@ class ImportController : public QDialog
MediaContainer *m_temporaryMedias;
quint32 m_nbMediaToLoad;
quint32 m_nbMediaLoaded;
ClipRenderer* m_clipRenderer;
public slots:
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