From 476d8768ee3d4b90d4c4569efbce861fec7d89d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fauconnier?= Date: Mon, 7 Jun 2021 15:06:14 +0200 Subject: [PATCH] don't call documentThumbnailsUpdated every time + set current document to null if it is about to be deleted --- src/document/UBDocumentController.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/document/UBDocumentController.cpp b/src/document/UBDocumentController.cpp index 5f7bef20..60a56854 100644 --- a/src/document/UBDocumentController.cpp +++ b/src/document/UBDocumentController.cpp @@ -2370,8 +2370,8 @@ void UBDocumentController::deleteMultipleItems(QModelIndexList indexes, UBDocume for (int i =0; i < indexes.size(); i++) { deleteIndexAndAssociatedData(indexes.at(i)); - emit documentThumbnailsUpdated(this); } + emit documentThumbnailsUpdated(this); break; } case EmptyFolder: @@ -2762,10 +2762,16 @@ void UBDocumentController::deleteIndexAndAssociatedData(const QModelIndex &pInde } //N/C - NNE - 20140408 - if(pIndex.column() == 0){ + if(pIndex.column() == 0) + { if (docModel->isDocument(pIndex)) { UBDocumentProxy *proxyData = docModel->proxyData(pIndex); + if (selectedDocument() == proxyData) + { + setDocument(nullptr); + } + if (proxyData) { UBPersistenceManager::persistenceManager()->deleteDocument(proxyData); }