[vlmc-devel] commit: ImportController: Fixing potential crash when reopening the window (Hugo Beauzee-Luyssen )
git at videolan.org
git at videolan.org
Thu Mar 11 00:08:44 CET 2010
vlmc | branch: master | Hugo Beauzee-Luyssen <beauze.h at gmail.com> | Wed Mar 10 23:49:49 2010 +0100| [b7be4a3a5155f34b6484974c2243c0733b028305] | committer: Hugo Beauzee-Luyssen
ImportController: Fixing potential crash when reopening the window
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=b7be4a3a5155f34b6484974c2243c0733b028305
---
src/Gui/import/ImportController.cpp | 12 +++++++-----
src/Gui/import/ImportController.h | 2 ++
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/Gui/import/ImportController.cpp b/src/Gui/import/ImportController.cpp
index 041127f..f44ed94 100644
--- a/src/Gui/import/ImportController.cpp
+++ b/src/Gui/import/ImportController.cpp
@@ -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 );
}
diff --git a/src/Gui/import/ImportController.h b/src/Gui/import/ImportController.h
index 3b8b1b0..271903a 100644
--- a/src/Gui/import/ImportController.h
+++ b/src/Gui/import/ImportController.h
@@ -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();
More information about the Vlmc-devel
mailing list