Fix possible crash on document close:

http://www.kdenlive.org:80/mantis/view.php?id=880

svn path=/trunk/kdenlive/; revision=3465
parent 78c81041
...@@ -1261,6 +1261,7 @@ void MainWindow::closeCurrentDocument() ...@@ -1261,6 +1261,7 @@ void MainWindow::closeCurrentDocument()
break; break;
case KMessageBox::Cancel : case KMessageBox::Cancel :
return; return;
break;
default: default:
break; break;
} }
...@@ -1270,13 +1271,16 @@ void MainWindow::closeCurrentDocument() ...@@ -1270,13 +1271,16 @@ void MainWindow::closeCurrentDocument()
m_timelineArea->setTabBarHidden(true); m_timelineArea->setTabBarHidden(true);
m_closeAction->setEnabled(false); m_closeAction->setEnabled(false);
} }
delete docToClose; if (docToClose == m_activeDocument) {
delete w; delete m_activeDocument;
if (m_timelineArea->count() == 0) {
m_activeDocument = NULL; m_activeDocument = NULL;
m_effectStack->clear(); m_effectStack->clear();
m_transitionConfig->slotTransitionItemSelected(NULL, false); m_transitionConfig->slotTransitionItemSelected(NULL, false);
} } else delete docToClose;
if (w == m_activeTimeline) {
delete m_activeTimeline;
m_activeTimeline = NULL;
} else delete w;
} }
bool MainWindow::saveFileAs(const QString &outputFileName) bool MainWindow::saveFileAs(const QString &outputFileName)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment