[Kdenlive-devel] [PATCH 16/37] slotDeleteTrack: Use QPointer
Mikko Rapeli
mikko.rapeli at iki.fi
Thu Jun 28 13:52:54 UTC 2012
Fixes crashes if parent is destroyed. Found by krazy. Details at:
http://blogs.kde.org/node/3919
---
src/customtrackview.cpp | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp
index 35927ed..431370c 100644
--- a/src/customtrackview.cpp
+++ b/src/customtrackview.cpp
@@ -5962,21 +5962,22 @@ void CustomTrackView::slotInsertTrack(int ix)
void CustomTrackView::slotDeleteTrack(int ix)
{
if (m_document->tracksCount() < 2) return;
- TrackDialog d(m_document, parentWidget());
- d.comboTracks->setCurrentIndex(ix);
- d.label->setText(i18n("Delete track"));
- d.before_select->setHidden(true);
- d.setWindowTitle(i18n("Delete Track"));
- d.video_track->setHidden(true);
- d.audio_track->setHidden(true);
- if (d.exec() == QDialog::Accepted) {
- ix = d.comboTracks->currentIndex();
+ QPointer<TrackDialog> d = new TrackDialog(m_document, parentWidget());
+ d->comboTracks->setCurrentIndex(ix);
+ d->label->setText(i18n("Delete track"));
+ d->before_select->setHidden(true);
+ d->setWindowTitle(i18n("Delete Track"));
+ d->video_track->setHidden(true);
+ d->audio_track->setHidden(true);
+ if (d->exec() == QDialog::Accepted) {
+ ix = d->comboTracks->currentIndex();
TrackInfo info = m_document->trackInfoAt(m_document->tracksCount() - ix - 1);
deleteTimelineTrack(ix, info);
setDocumentModified();
/*AddTrackCommand* command = new AddTrackCommand(this, ix, info, false);
m_commandStack->push(command);*/
}
+ delete d;
}
void CustomTrackView::slotConfigTracks(int ix)
--
1.7.10.4
More information about the Kdenlive
mailing list