[Kdenlive-devel] [PATCH 15/37] slotInsertTrack: Use QPointer
Mikko Rapeli
mikko.rapeli at iki.fi
Thu Jun 28 13:52:53 UTC 2012
Fixes crashes if parent is destroyed. Found by krazy. Details at:
http://blogs.kde.org/node/3919
---
src/customtrackview.cpp | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp
index 38f557d..35927ed 100644
--- a/src/customtrackview.cpp
+++ b/src/customtrackview.cpp
@@ -5931,21 +5931,21 @@ void CustomTrackView::saveThumbnails()
void CustomTrackView::slotInsertTrack(int ix)
{
- TrackDialog d(m_document, parentWidget());
- d.comboTracks->setCurrentIndex(ix);
- d.label->setText(i18n("Insert track"));
- d.setWindowTitle(i18n("Insert New Track"));
+ QPointer<TrackDialog> d = new TrackDialog(m_document, parentWidget());
+ d->comboTracks->setCurrentIndex(ix);
+ d->label->setText(i18n("Insert track"));
+ d->setWindowTitle(i18n("Insert New Track"));
- if (d.exec() == QDialog::Accepted) {
- ix = d.comboTracks->currentIndex();
- if (d.before_select->currentIndex() == 1)
+ if (d->exec() == QDialog::Accepted) {
+ ix = d->comboTracks->currentIndex();
+ if (d->before_select->currentIndex() == 1)
ix++;
TrackInfo info;
info.duration = 0;
info.isMute = false;
info.isLocked = false;
info.effectsList = EffectsList(true);
- if (d.video_track->isChecked()) {
+ if (d->video_track->isChecked()) {
info.type = VIDEOTRACK;
info.isBlind = false;
} else {
@@ -5956,6 +5956,7 @@ void CustomTrackView::slotInsertTrack(int ix)
m_commandStack->push(addTrack);
setDocumentModified();
}
+ delete d;
}
void CustomTrackView::slotDeleteTrack(int ix)
--
1.7.10.4
More information about the Kdenlive
mailing list