fixed a crash that would randomly occur when performing multiple deletion inside the trash

preferencesAboutTextFull
Clément Fauconnier 3 years ago
parent 476d8768ee
commit 30087bb34d
  1. 13
      src/document/UBDocumentController.cpp

@ -2762,10 +2762,11 @@ void UBDocumentController::deleteIndexAndAssociatedData(const QModelIndex &pInde
}
//N/C - NNE - 20140408
UBDocumentProxy *proxyData = nullptr;
if(pIndex.column() == 0)
{
if (docModel->isDocument(pIndex)) {
UBDocumentProxy *proxyData = docModel->proxyData(pIndex);
proxyData = docModel->proxyData(pIndex);
if (selectedDocument() == proxyData)
{
@ -2778,7 +2779,15 @@ void UBDocumentController::deleteIndexAndAssociatedData(const QModelIndex &pInde
}
}
docModel->removeRow(pIndex.row(), pIndex.parent());
if (proxyData)
{
// need to recall indexForProxy as rows could have changed when performing a multiple deletion
QModelIndex indexForProxy = docModel->indexForProxy(proxyData);
if (!docModel->removeRow(indexForProxy.row(), indexForProxy.parent()))
{
qDebug() << "could not remove row (r:" << indexForProxy.row() << "p:" << indexForProxy.parent() << ")";
}
}
}

Loading…
Cancel
Save