Commit 27086dcd authored by Laurent Montel's avatar Laurent Montel 😁

Fix crash when we delete attachment

parent daf44aa1
......@@ -252,7 +252,9 @@ void AttachmentControllerBase::Private::editSelectedAttachmentWith()
void AttachmentControllerBase::Private::removeSelectedAttachments()
{
Q_ASSERT(selectedParts.count() >= 1);
for (const AttachmentPart::Ptr &part : qAsConst(selectedParts)) {
//We must store list, otherwise when we remove it changes selectedParts (as selection changed) => it will crash.
const AttachmentPart::List toRemove = selectedParts;
for (const AttachmentPart::Ptr &part : toRemove) {
model->removeAttachment(part);
}
}
......
Markdown is supported
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