Commit 336e3d2b authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix crash when closing a document that was still creating thumbs

parent 4e115e20
......@@ -495,22 +495,7 @@ Bin::~Bin()
blockSignals(true);
m_proxyModel->selectionModel()->blockSignals(true);
setEnabled(false);
abortAudioThumbs();
if (m_propertiesPanel) {
foreach (QWidget * w, m_propertiesPanel->findChildren<ClipPropertiesController*>()) {
delete w;
}
}
if (m_rootFolder) {
while (!m_rootFolder->isEmpty()) {
AbstractProjectItem *child = m_rootFolder->at(0);
m_rootFolder->removeChild(child);
delete child;
}
}
delete m_rootFolder;
delete m_itemView;
delete m_jobManager;
abortOperations();
delete m_infoMessage;
delete m_propertiesPanel;
}
......@@ -551,6 +536,31 @@ void Bin::processAudioThumbs()
m_audioThumbsThread = QtConcurrent::run(this, &Bin::slotCreateAudioThumbs);
}
void Bin::abortOperations()
{
blockSignals(true);
abortAudioThumbs();
if (m_propertiesPanel) {
foreach (QWidget * w, m_propertiesPanel->findChildren<ClipPropertiesController*>()) {
delete w;
}
}
if (m_rootFolder) {
while (!m_rootFolder->isEmpty()) {
AbstractProjectItem *child = m_rootFolder->at(0);
m_rootFolder->removeChild(child);
delete child;
}
}
delete m_rootFolder;
m_rootFolder = NULL;
delete m_itemView;
m_itemView = NULL;
delete m_jobManager;
m_jobManager = NULL;
blockSignals(false);
}
void Bin::abortAudioThumbs()
{
if (!m_audioThumbsThread.isRunning()) return;
......
......@@ -647,6 +647,8 @@ public slots:
void slotGetCurrentProjectImage(bool request);
void slotExpandUrl(ItemInfo info, QUrl url, QUndoCommand *command);
void abortAudioThumbs();
/** @brief Abort all ongoing operations to prepare close. */
void abortOperations();
void doDisplayMessage(const QString &text, KMessageWidget::MessageType type, QList <QAction*> actions = QList <QAction*>());
/** @brief Reset all clip usage to 0 */
void resetUsageCount();
......
......@@ -1456,7 +1456,7 @@ void KdenliveDoc::loadDocumentProperties()
void KdenliveDoc::updateProjectProfile(bool reloadProducers)
{
pCore->bin()->abortAudioThumbs();
pCore->bin()->abortOperations();
pCore->producerQueue()->abortOperations();
KdenliveSettings::setProject_display_ratio((double) m_profile.display_aspect_num / m_profile.display_aspect_den);
double fps = (double) m_profile.frame_rate_num / m_profile.frame_rate_den;
......
......@@ -255,7 +255,7 @@ bool ProjectManager::closeCurrentDocument(bool saveChanges, bool quit)
m_autoSaveTimer.stop();
if (m_project) {
pCore->producerQueue()->abortOperations();
pCore->bin()->abortAudioThumbs();
pCore->bin()->abortOperations();
pCore->window()->slotTimelineClipSelected(NULL, false);
pCore->monitorManager()->clipMonitor()->slotOpenClip(NULL);
pCore->window()->m_effectStack->clear();
......
Supports Markdown
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