]> git.sesse.net Git - kdenlive/commitdiff
Fix uninitialized value in group checking:
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 20 Oct 2009 13:45:19 +0000 (13:45 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 20 Oct 2009 13:45:19 +0000 (13:45 +0000)
http://www.kdenlive.org:80/mantis/view.php?id=1218

svn path=/trunk/kdenlive/; revision=4051

src/customtrackview.cpp
src/customtrackview.h

index dedadb36ab961d52cd679b821c63d47ead08621e..99fd9666312bbafa54896aa8490d6fdf1ecc79ab 100644 (file)
@@ -809,7 +809,7 @@ void CustomTrackView::mousePressEvent(QMouseEvent * event)
                 QRectF rect(mapToScene(m_clickEvent).x(), track * m_tracksHeight + m_tracksHeight / 2, sceneRect().width() - mapToScene(m_clickEvent).x(), m_tracksHeight / 2 - 2);
 
                 bool isOk;
-                selection = checkForGroups(rect, isOk);
+                selection = checkForGroups(rect, &isOk);
                 if (!isOk) {
                     // groups found on track, do not allow the move
                     emit displayMessage(i18n("Cannot use spacer in a track with a group"), ErrorMessage);
@@ -2261,18 +2261,19 @@ void CustomTrackView::slotSwitchTrackVideo(int ix)
     setDocumentModified();
 }
 
-QList<QGraphicsItem *> CustomTrackView::checkForGroups(const QRectF &rect, bool &ok)
+QList<QGraphicsItem *> CustomTrackView::checkForGroups(const QRectF &rect, bool *ok)
 {
     // Check there is no group going over several tracks there, or that would result in timeline corruption
     QList<QGraphicsItem *> selection = scene()->items(rect);
+    *ok = true;
     int maxHeight = m_tracksHeight * 1.5;
     for (int i = 0; i < selection.count(); i++) {
         // Check that we don't try to move a group with clips on other tracks
         if (selection.at(i)->type() == GROUPWIDGET && (selection.at(i)->boundingRect().height() >= maxHeight)) {
-            ok = false;
+            *ok = false;
             break;
         } else if (selection.at(i)->parentItem() && (selection.at(i)->parentItem()->boundingRect().height() >= maxHeight)) {
-            ok = false;
+            *ok = false;
             break;
         }
     }
@@ -2309,7 +2310,7 @@ void CustomTrackView::slotRemoveSpace()
     QRectF rect(pos.frames(m_document->fps()), track * m_tracksHeight + m_tracksHeight / 2, sceneRect().width() - pos.frames(m_document->fps()), m_tracksHeight / 2 - 2);
 
     bool isOk;
-    QList<QGraphicsItem *> items = checkForGroups(rect, isOk);
+    QList<QGraphicsItem *> items = checkForGroups(rect, &isOk);
     if (!isOk) {
         // groups found on track, do not allow the move
         emit displayMessage(i18n("Cannot remove space in a track with a group"), ErrorMessage);
@@ -2356,7 +2357,7 @@ void CustomTrackView::slotInsertSpace()
     // Make sure there is no group in the way
     QRectF rect(pos.frames(m_document->fps()), track * m_tracksHeight + m_tracksHeight / 2, sceneRect().width() - pos.frames(m_document->fps()), m_tracksHeight / 2 - 2);
     bool isOk;
-    QList<QGraphicsItem *> items = checkForGroups(rect, isOk);
+    QList<QGraphicsItem *> items = checkForGroups(rect, &isOk);
     if (!isOk) {
         // groups found on track, do not allow the move
         emit displayMessage(i18n("Cannot insert space in a track with a group"), ErrorMessage);
index d2e85b61606a9bfe961184ca0a0d3695514fa5c8..ba7bfa745f5204d0b5d3a9a2019d1b69e3f354b1 100644 (file)
@@ -261,7 +261,7 @@ private:
     /** Whether an item can be moved to a new position without colliding with similar items */
     bool itemCollision(AbstractClipItem *item, ItemInfo newPos);
     /** Selects all items in the scene rect, and sets ok to false if a group going over several tracks is found in it */
-    QList<QGraphicsItem *> checkForGroups(const QRectF &rect, bool &ok);
+    QList<QGraphicsItem *> checkForGroups(const QRectF &rect, bool *ok);
 
 private slots:
     void slotRefreshGuides();