]> git.sesse.net Git - kdenlive/commitdiff
Fix crash when pasting effects on a group:
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 2 Feb 2010 14:19:04 +0000 (14:19 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 2 Feb 2010 14:19:04 +0000 (14:19 +0000)
http://kdenlive.org/mantis/view.php?id=1411

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

src/customtrackview.cpp

index a91aadb4d400973c9a7c7cfab35c52dde1bdc70c..f6ea43dba3606155a3e6bc9fc66a664e81cd75c6 100644 (file)
@@ -4759,6 +4759,20 @@ void CustomTrackView::pasteClipEffects()
     paste->setText("Paste effects");
 
     QList<QGraphicsItem *> clips = scene()->selectedItems();
+
+    // expand groups
+    for (int i = 0; i < clips.count(); ++i) {
+       if (clips.at(i)->type() == GROUPWIDGET) {
+           QList<QGraphicsItem *> children = clips.at(i)->childItems();
+           for (int j = 0; j < children.count(); j++) {
+               if (children.at(j)->type() == AVWIDGET && !clips.contains(children.at(j))) {
+                   clips.append(children.at(j));
+               }
+           }
+       }
+    }
+
+
     for (int i = 0; i < clips.count(); ++i) {
         if (clips.at(i)->type() == AVWIDGET) {
             ClipItem *item = static_cast < ClipItem *>(clips.at(i));
@@ -4771,12 +4785,15 @@ void CustomTrackView::pasteClipEffects()
             }
         }
     }
-    m_commandStack->push(paste);
+    if (paste->childCount() > 0) m_commandStack->push(paste);
+    else delete paste;
 
-    // adjust effects (fades, ...)
+    // adjust effects (fades, ...)
     for (int i = 0; i < clips.count(); ++i) {
-        ClipItem *item = static_cast < ClipItem *>(clips.at(i));
-        updatePositionEffects(item, item->info());
+       if (clips.at(i)->type() == AVWIDGET) {
+           ClipItem *item = static_cast < ClipItem *>(clips.at(i));
+           updatePositionEffects(item, item->info());
+       }
     }
 }