Skip to content

Commit

Permalink
fix crash after drag XML to empty playlist
Browse files Browse the repository at this point in the history
...but before playing it or adding to timeline, when autosave runs.
Also, in that same situation but before autosave, and choose File >
Close or New.
  • Loading branch information
ddennedy committed Nov 11, 2024
1 parent 148c80c commit 44c28ec
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3252,13 +3252,14 @@ bool MainWindow::saveXML(const QString &filename, bool withRelativePaths)
QString notes = m_notesDock->getText();
if (m_timelineDock->model()->rowCount() > 0) {
result = MLT.saveXML(filename, multitrack(), withRelativePaths, nullptr, false, notes);
} else if (m_playlistDock->model()->rowCount() > 0) {
} else if (m_playlistDock->model()->rowCount() > 0 && MLT.producer()
&& MLT.producer()->is_valid()) {
int in = MLT.producer()->get_in();
int out = MLT.producer()->get_out();
MLT.producer()->set_in_and_out(0, MLT.producer()->get_length() - 1);
result = MLT.saveXML(filename, playlist(), withRelativePaths, nullptr, false, notes);
MLT.producer()->set_in_and_out(in, out);
} else if (MLT.producer()) {
} else if (MLT.producer() && MLT.producer()->is_valid()) {
result = MLT.saveXML(filename, (MLT.isMultitrack()
|| MLT.isPlaylist()) ? MLT.savedProducer() : 0, withRelativePaths, nullptr, false, notes);
} else {
Expand Down Expand Up @@ -4266,7 +4267,8 @@ void MainWindow::on_actionClose_triggered()
MLT.setProjectFolder(QString());
ui->actionSave->setEnabled(false);
MLT.stop();
MLT.consumer()->purge();
if (MLT.consumer() && MLT.consumer()->is_valid())
MLT.consumer()->purge();
QCoreApplication::processEvents();
if (multitrack())
m_timelineDock->model()->close();
Expand Down

0 comments on commit 44c28ec

Please sign in to comment.