summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Mardelle <jb@kdenlive.org>2016-12-03 15:39:45 (GMT)
committerJean-Baptiste Mardelle <jb@kdenlive.org>2016-12-03 15:39:45 (GMT)
commit336e3d2baf10d845cc7d14bccb3164ac1f8b6957 (patch)
tree9832f12673e42581b7ba021856b5d5b128aa8c83
parent4e115e20d62303d539a2c5a3356ec392f4a31cf7 (diff)
Fix crash when closing a document that was still creating thumbs
-rw-r--r--src/bin/bin.cpp42
-rw-r--r--src/bin/bin.h2
-rw-r--r--src/doc/kdenlivedoc.cpp2
-rw-r--r--src/project/projectmanager.cpp2
4 files changed, 30 insertions, 18 deletions
diff --git a/src/bin/bin.cpp b/src/bin/bin.cpp
index 90f313f..2a45358 100644
--- a/src/bin/bin.cpp
+++ b/src/bin/bin.cpp
@@ -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;
diff --git a/src/bin/bin.h b/src/bin/bin.h
index 5f033d5..f1978be 100644
--- a/src/bin/bin.h
+++ b/src/bin/bin.h
@@ -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();
diff --git a/src/doc/kdenlivedoc.cpp b/src/doc/kdenlivedoc.cpp
index 328d102..412a607 100644
--- a/src/doc/kdenlivedoc.cpp
+++ b/src/doc/kdenlivedoc.cpp
@@ -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;
diff --git a/src/project/projectmanager.cpp b/src/project/projectmanager.cpp
index 6b1d184..2ff6d84 100644
--- a/src/project/projectmanager.cpp
+++ b/src/project/projectmanager.cpp
@@ -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();