]> git.sesse.net Git - kdenlive/commitdiff
[PATCH 4/6] Simplify some object deletion code
authorRay Lehtiniemi <rayl@mail.com>
Fri, 10 Apr 2009 15:05:39 +0000 (15:05 +0000)
committerRay Lehtiniemi <rayl@mail.com>
Fri, 10 Apr 2009 15:05:39 +0000 (15:05 +0000)
Signed-off-by: Ray Lehtiniemi <rayl@mail.com>
svn path=/trunk/kdenlive/; revision=3279

src/clipmanager.cpp
src/customtrackview.cpp
src/dvdwizardvob.cpp
src/effectstackedit.cpp
src/trackview.cpp

index b591d8f00fc92a55578402208d79f2ff83451898..4dee93795d848033d5492952d69a1df98275e0e8 100644 (file)
@@ -157,9 +157,7 @@ void ClipManager::deleteClip(const QString &clipId)
 {
     for (int i = 0; i < m_clipList.count(); i++) {
         if (m_clipList.at(i)->getId() == clipId) {
-            DocClipBase *clip = m_clipList.takeAt(i);
-            delete clip;
-            clip = NULL;
+            delete m_clipList.takeAt(i);
             break;
         }
     }
index bd6f955e8ea5ef0aa7ec00cdd51b0cda684c4121..91b21204812c87638341cec166dcbe82e52b58a2 100644 (file)
@@ -3480,8 +3480,7 @@ void CustomTrackView::editGuide(const GenTime oldPos, const GenTime pos, const Q
         bool found = false;
         for (int i = 0; i < m_guides.count(); i++) {
             if (m_guides.at(i)->position() == oldPos) {
-                Guide *item = m_guides.takeAt(i);
-                delete item;
+                delete m_guides.takeAt(i);
                 found = true;
                 break;
             }
@@ -3693,9 +3692,8 @@ void CustomTrackView::clearSearchStrings()
 
 void CustomTrackView::copyClip()
 {
-    while (m_copiedItems.count() > 0) {
-        delete m_copiedItems.takeFirst();
-    }
+    qDeleteAll(m_copiedItems);
+    m_copiedItems.clear();
     QList<QGraphicsItem *> itemList = scene()->selectedItems();
     if (itemList.count() == 0) {
         emit displayMessage(i18n("Select a clip before copying"), ErrorMessage);
index 6955eb696cab1bf144e8c01fe4cad335faaa16dc..a9dbfc67ebd0dddd3ba794bf8fb9063f853ac9fd 100644 (file)
@@ -108,8 +108,7 @@ void DvdWizardVob::slotCheckVobList(const QString &text)
     } else if (text.isEmpty()) {
         if (allUrls.at(count - 1)->url().path().isEmpty() && allUrls.at(count - 2)->url().path().isEmpty()) {
             // The last 2 urlrequesters are empty, remove last one
-            KUrlRequester *vob = allUrls.takeLast();
-            delete vob;
+            delete allUrls.takeLast();
         }
     } else {
         if (allUrls.at(count - 1)->url().path().isEmpty()) return;
index 8d199bba0f8bb6ae514640b62108be38a2f2786d..641f82aa6e877edab9b599f0e10b85550b37ae64 100644 (file)
@@ -476,9 +476,7 @@ void EffectStackEdit::slotSliderMoved(int)
 void EffectStackEdit::clearAllItems()
 {
     qDeleteAll(items);
-    foreach(UiItem *p, uiItems) {
-        delete p;
-    }
+    qDeleteAll(uiItems);
     uiItems.clear();
     items.clear();
     valueItems.clear();
index 6e193b37be0a2e93607d7563cf8f7a172fd08cf5..659891266154c40fcfc183cf4422af867c34c8cb 100644 (file)
@@ -404,8 +404,7 @@ void TrackView::slotRebuildTrackHeaders()
 {
     QList <TrackInfo> list = m_doc->tracksList();
     QList<HeaderTrack *> widgets = findChildren<HeaderTrack *>();
-    for (int i = 0; i < widgets.count(); i++)
-        delete widgets.at(i);
+    qDeleteAll(widgets);
     int max = list.count();
     for (int i = 0; i < max; i++) {
         HeaderTrack *header = new HeaderTrack(i, list.at(max - i - 1), this);