diff --git a/src/core/UBApplication.cpp b/src/core/UBApplication.cpp index 9e74e09a3..e7d7853ab 100644 --- a/src/core/UBApplication.cpp +++ b/src/core/UBApplication.cpp @@ -79,6 +79,8 @@ UBDocumentController* UBApplication::documentController = 0; UBMainWindow* UBApplication::mainWindow = 0; +bool UBApplication::isClosing = false; + const QString UBApplication::mimeTypeUniboardDocument = QString("application/vnd.mnemis-uniboard-document"); const QString UBApplication::mimeTypeUniboardPage = QString("application/vnd.mnemis-uniboard-page"); const QString UBApplication::mimeTypeUniboardPageItem = QString("application/vnd.mnemis-uniboard-page-item"); @@ -507,6 +509,8 @@ void UBApplication::closeEvent(QCloseEvent *event) void UBApplication::closing() { + isClosing = true; + if (UBSettings::settings()->emptyTrashForOlderDocuments->get().toBool()) { UBDocumentTreeModel *docModel = UBPersistenceManager::persistenceManager()->mDocumentTreeStructureModel; diff --git a/src/core/UBApplication.h b/src/core/UBApplication.h index 9347c5b63..ab13cf832 100644 --- a/src/core/UBApplication.h +++ b/src/core/UBApplication.h @@ -78,6 +78,8 @@ class UBApplication : public SingleApplication static UBMainWindow* mainWindow; + static bool isClosing; + static UBApplication* app() { return dynamic_castqApp; diff --git a/src/core/UBSceneCache.cpp b/src/core/UBSceneCache.cpp index a1c788cdc..fb5896d3a 100644 --- a/src/core/UBSceneCache.cpp +++ b/src/core/UBSceneCache.cpp @@ -322,6 +322,13 @@ void UBSceneCache::SceneCacheEntry::startLoading() { mTimer = new QTimer; QObject::connect(mTimer, &QTimer::timeout, mTimer, [this](){ + if (UBApplication::isClosing) + { + mTimer->stop(); + delete mTimer; + return; + } + if (mContext) { mContext->step();