Commit 81a54b54 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix possible crash on profile switch

parent bfec04aa
...@@ -1376,6 +1376,8 @@ void KdenliveDoc::resetProfile() ...@@ -1376,6 +1376,8 @@ void KdenliveDoc::resetProfile()
void KdenliveDoc::slotSwitchProfile(const QString &profile_path) void KdenliveDoc::slotSwitchProfile(const QString &profile_path)
{ {
// Discard all current jobs
pCore->jobManager()->slotCancelJobs();
pCore->setCurrentProfile(profile_path); pCore->setCurrentProfile(profile_path);
updateProjectProfile(true); updateProjectProfile(true);
emit docModified(true); emit docModified(true);
...@@ -1409,6 +1411,8 @@ void KdenliveDoc::switchProfile(std::unique_ptr<ProfileParam> &profile, const QS ...@@ -1409,6 +1411,8 @@ void KdenliveDoc::switchProfile(std::unique_ptr<ProfileParam> &profile, const QS
switch (answer) { switch (answer) {
case KMessageBox::Yes: case KMessageBox::Yes:
// Discard all current jobs
pCore->jobManager()->slotCancelJobs();
KdenliveSettings::setDefault_profile(profile->path()); KdenliveSettings::setDefault_profile(profile->path());
pCore->setCurrentProfile(profile->path()); pCore->setCurrentProfile(profile->path());
updateProjectProfile(true); updateProjectProfile(true);
...@@ -1475,6 +1479,8 @@ void KdenliveDoc::switchProfile(std::unique_ptr<ProfileParam> &profile, const QS ...@@ -1475,6 +1479,8 @@ void KdenliveDoc::switchProfile(std::unique_ptr<ProfileParam> &profile, const QS
.arg(profile->m_height) .arg(profile->m_height)
.arg(QString::number((double)profile->m_frame_rate_num / profile->m_frame_rate_den, 'f', 2)); .arg(QString::number((double)profile->m_frame_rate_num / profile->m_frame_rate_den, 'f', 2));
QString profilePath = ProfileRepository::get()->saveProfile(profile.get()); QString profilePath = ProfileRepository::get()->saveProfile(profile.get());
// Discard all current jobs
pCore->jobManager()->slotCancelJobs();
pCore->setCurrentProfile(profilePath); pCore->setCurrentProfile(profilePath);
updateProjectProfile(true); updateProjectProfile(true);
emit docModified(true); emit docModified(true);
......
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