]> git.sesse.net Git - kdenlive/commitdiff
Fix crash in scopes: http://kdenlive.org/mantis/view.php?id=2779
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 14 Oct 2012 19:56:30 +0000 (21:56 +0200)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 14 Oct 2012 19:56:30 +0000 (21:56 +0200)
src/colorcorrection/rgbparadegenerator.cpp
src/mainwindow.cpp
src/projectlist.cpp
src/projectlist.h
src/projectlistview.cpp
src/renderer.cpp
src/scopes/colorscopes/abstractgfxscopewidget.cpp
src/scopes/colorscopes/abstractgfxscopewidget.h
src/scopes/scopemanager.cpp
src/scopes/scopemanager.h

index cd2a0048c8cea9a6c3badf9749435a2632f4ebc7..f8ad5cd0c6d3481e3bb61daef08d93586c099d6c 100644 (file)
@@ -47,7 +47,7 @@ QImage RGBParadeGenerator::calculateRGBParade(const QSize &paradeSize, const QIm
 
     } else {
         QImage parade(paradeSize, QImage::Format_ARGB32);
-        parade.fill(qRgba(0,0,0,0));
+        parade.fill(Qt::transparent);
 
         QRgb *col;
         QPainter davinci(&parade);
@@ -92,7 +92,6 @@ QImage RGBParadeGenerator::calculateRGBParade(const QSize &paradeSize, const QIm
         const uint stepsize = 4*accelFactor;
 
         for (uint i = 0, x = 0; i < byteCount; i += stepsize) {
-
             col = (QRgb *)bits;
             r = qRed(*col);
             g = qGreen(*col);
index e80868fd86775a6d5b07d7d715717845b17c7f37..5ca55a8a4bcd2bcebf776e61e60529b920fd638d 100644 (file)
@@ -912,6 +912,7 @@ void MainWindow::slotUpdateClip(const QString &id)
 void MainWindow::slotConnectMonitors()
 {
     m_projectList->setRenderer(m_projectMonitor->render);
+    connect(m_projectList, SIGNAL(pauseMonitor()), m_monitorManager, SLOT(slotPause()));
     connect(m_projectList, SIGNAL(deleteProjectClips(QStringList, QMap<QString, QString>)), this, SLOT(slotDeleteProjectClips(QStringList, QMap<QString, QString>)));
     connect(m_projectList, SIGNAL(showClipProperties(DocClipBase *)), this, SLOT(slotShowClipProperties(DocClipBase *)));
     connect(m_projectList, SIGNAL(showClipProperties(QList <DocClipBase *>, QMap<QString, QString>)), this, SLOT(slotShowClipProperties(QList <DocClipBase *>, QMap<QString, QString>)));
index d60e3081db98577306709b5a425629c4e1a0344e..be927c1b6a89b76ddde8484b8d2e87f01dedcaea 100644 (file)
@@ -310,8 +310,9 @@ ProjectList::ProjectList(QWidget *parent) :
     connect(m_listView, SIGNAL(projectModified()), this, SIGNAL(projectModified()));
     connect(m_listView, SIGNAL(itemSelectionChanged()), this, SLOT(slotClipSelected()));
     connect(m_listView, SIGNAL(focusMonitor()), this, SIGNAL(raiseClipMonitor()));
-    connect(m_listView, SIGNAL(pauseMonitor()), this, SLOT(slotPauseMonitor()));
+    connect(m_listView, SIGNAL(pauseMonitor()), this, SIGNAL(pauseMonitor()));
     connect(m_listView, SIGNAL(requestMenu(const QPoint &, QTreeWidgetItem *)), this, SLOT(slotContextMenu(const QPoint &, QTreeWidgetItem *)));
+    connect(m_listView, SIGNAL(addClip()), this, SIGNAL(pauseMonitor()));
     connect(m_listView, SIGNAL(addClip()), this, SLOT(slotAddClip()));
     connect(m_listView, SIGNAL(addClip(const QList <QUrl>, const QString &, const QString &)), this, SLOT(slotAddClip(const QList <QUrl>, const QString &, const QString &)));
     connect(this, SIGNAL(addClip(const QString, const QString &, const QString &)), this, SLOT(slotAddClip(const QString, const QString &, const QString &)));
index 7d7e384fd4b5f04a2fc6ea676592a6935b39dc94..8ed251afc507455e7f1a3c9b11f2090a3a7199d6 100644 (file)
@@ -523,6 +523,7 @@ signals:
     void checkJobProcess();
     /** @brief A Filter Job produced results, send them back to the clip. */
     void gotFilterJobResults(const QString &id, int startPos, int track, const QString &filterName, stringMap params);
+    void pauseMonitor();
 };
 
 #endif
index cda2480a6703a2470274a33f2ba3117aec16c5e7..21e212c220bc467f3bcfc1913610add2187bf636 100644 (file)
@@ -184,6 +184,7 @@ void ProjectListView::mouseDoubleClickEvent(QMouseEvent * event)
 {
     QTreeWidgetItem *it = itemAt(event->pos());
     if (!it) {
+       emit pauseMonitor();
         emit addClip();
         return;
     }
index 7572a6b96cda27b62d73bb5fa6028b2d51fe16d1..c163bb12bb6f8c5102d6264bcdd861b401f173ad 100644 (file)
@@ -1705,13 +1705,6 @@ void Render::emitFrameUpdated(Mlt::Frame& frame)
     const uchar* image = frame.get_image(format, width, height);
     QImage qimage(width, height, QImage::Format_ARGB32_Premultiplied);
     memcpy(qimage.scanLine(0), image, width * height * 4);
-
-    /*mlt_image_format format = mlt_image_rgb24;
-    int width = 0;
-    int height = 0;
-    const uchar* image = frame.get_image(format, width, height);
-    QImage qimage(width, height, QImage::Format_RGB888);
-    memcpy(qimage.bits(), image, width * height * 3);*/
     emit frameUpdated(qimage.rgbSwapped());
 }
 
index 430b33190524f4507ba120523c55f2dface65162..39343490951b048891f8868a598a681509d2c969 100644 (file)
@@ -37,6 +37,7 @@ AbstractGfxScopeWidget::~AbstractGfxScopeWidget() { }
 
 QImage AbstractGfxScopeWidget::renderScope(uint accelerationFactor)
 {
+    QMutexLocker lock(&m_mutex);
     return renderGfxScope(accelerationFactor, m_scopeImage);
 }
 
@@ -50,8 +51,9 @@ void AbstractGfxScopeWidget::mouseReleaseEvent(QMouseEvent *event)
 ///// Slots /////
 
 
-void AbstractGfxScopeWidget::slotRenderZoneUpdated(QImage frame)
+void AbstractGfxScopeWidget::slotRenderZoneUpdated(const QImage frame)
 {
+    QMutexLocker lock(&m_mutex);
     m_scopeImage = frame;
     AbstractScopeWidget::slotRenderZoneUpdated();
 }
index cd8d68e4980e8ba9fcf003765bb40ad2db9d3585..a4ff72c1523521286193ab05e4841a0b6f7ea9f7 100644 (file)
@@ -45,12 +45,13 @@ protected:
 
 private:
     QImage m_scopeImage;
+    QMutex m_mutex;
 
 public slots:
     /** @brief Must be called when the active monitor has shown a new frame.
       This slot must be connected in the implementing class, it is *not*
       done in this abstract class. */
-    void slotRenderZoneUpdated(QImage);
+    void slotRenderZoneUpdated(const QImage);
 
 protected slots:
     virtual void slotAutoRefreshToggled(bool autoRefresh);
index a1fc1416a9be450b549cae162f0249d4a5e83632..283dc3417ccf6504632e2bd3b87d71085765f903 100644 (file)
@@ -129,7 +129,7 @@ void ScopeManager::slotDistributeAudio(QVector<int16_t> sampleData, int freq, in
 
     checkActiveAudioScopes();
 }
-void ScopeManager::slotDistributeFrame(QImage image)
+void ScopeManager::slotDistributeFrame(const QImage image)
 {
 #ifdef DEBUG_SM
     qDebug() << "ScopeManager: Starting to distribute frame.";
@@ -205,8 +205,8 @@ void ScopeManager::slotUpdateActiveRenderer()
 
     // Connect new renderer
     if (m_lastConnectedRenderer != NULL) {
-        b &= connect(m_lastConnectedRenderer, SIGNAL(frameUpdated(QImage)),
-                this, SLOT(slotDistributeFrame(QImage)), Qt::UniqueConnection);
+        b &= connect(m_lastConnectedRenderer, SIGNAL(frameUpdated(const QImage)),
+                this, SLOT(slotDistributeFrame(const QImage)), Qt::UniqueConnection);
         b &= connect(m_lastConnectedRenderer, SIGNAL(audioSamplesSignal(QVector<int16_t>,int,int,int)),
                 this, SLOT(slotDistributeAudio(QVector<int16_t>,int,int,int)), Qt::UniqueConnection);
         Q_ASSERT(b);
index 79b45e1eb33954a5b95017959a562f063f9572b5..d4d98d434da2552363f00e7890a92c4e0246ec6e 100644 (file)
@@ -115,7 +115,7 @@ private slots:
       */
     
     void slotCheckActiveScopes();
-    void slotDistributeFrame(QImage image);
+    void slotDistributeFrame(const QImage image);
     void slotDistributeAudio(QVector<int16_t> sampleData, int freq, int num_channels, int num_samples);
     /**
       Allows a scope to explicitly request a new frame, even if the scope's autoRefresh is disabled.