Fix possible crash when downloading attachments

frm maintainer Caspar Schutijser
This commit is contained in:
jca 2020-03-14 01:17:13 +00:00
parent fec228bef6
commit ebe06207fa
2 changed files with 47 additions and 2 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.32 2020/02/28 19:30:31 rsadowski Exp $
# $OpenBSD: Makefile,v 1.33 2020/03/14 01:17:13 jca Exp $
COMMENT = fast Qt IMAP e-mail client
DISTNAME = trojita-0.7
REVISION = 10
REVISION = 11
SHARED_LIBS = trojita_plugins 2.0 # 2.0

View File

@ -0,0 +1,45 @@
$OpenBSD: patch-src_Imap_Network_FileDownloadManager_cpp,v 1.1 2020/03/14 01:17:13 jca Exp $
https://cgit.kde.org/trojita.git/commit/?id=cf2364b80fa8ae844df8350cd5833d47cce235f2
commit cf2364b80fa8ae844df8350cd5833d47cce235f2
Author: Jan Kundrát <jkt@kde.org>
Date: Mon Mar 9 08:24:48 2020 -0700
Fix possible crash when downloading attachments
Turns out we've been happily deleting network replies from the
QNetworkReply::finished(). That was never a good thing to do, but it did
not use to crash with older Qt. Now it does.
[...]
Index: src/Imap/Network/FileDownloadManager.cpp
--- src/Imap/Network/FileDownloadManager.cpp.orig
+++ src/Imap/Network/FileDownloadManager.cpp
@@ -139,7 +139,9 @@ void FileDownloadManager::downloadMessage()
void FileDownloadManager::onPartDataTransfered()
{
- Q_ASSERT(reply);
+ if (!reply) {
+ return;
+ }
if (reply->error() == QNetworkReply::NoError) {
if (!saving.open(QIODevice::WriteOnly)) {
emit transferError(saving.errorString());
@@ -192,11 +194,11 @@ void FileDownloadManager::onCombinerTransferError(cons
void FileDownloadManager::deleteReply(QNetworkReply *reply)
{
- if (reply == this->reply) {
+ if (reply && reply == this->reply) {
if (!saved)
onPartDataTransfered();
- delete reply;
- this->reply = 0;
+ reply->deleteLater();
+ this->reply = nullptr;
}
}