Account: Fix crash when deleting an account

We should not have request parented to the account, otherwise we might get
a loop on the deletion order.

Issue #6893
This commit is contained in:
Olivier Goffart 2018-11-22 08:46:33 +01:00 committed by Olivier Goffart
parent 47634ffed0
commit 93d3d0441b
2 changed files with 4 additions and 1 deletions

View File

@ -55,6 +55,9 @@ AbstractNetworkJob::AbstractNetworkJob(AccountPtr account, const QString &path,
, _path(path)
, _redirectCount(0)
{
// Since we hold a QSharedPointer to the account, this makes no sense. (issue #6893)
ASSERT(account != parent);
_timer.setSingleShot(true);
_timer.setInterval((httpTimeout ? httpTimeout : 300) * 1000); // default to 5 minutes.
connect(&_timer, &QTimer::timeout, this, &AbstractNetworkJob::slotTimeout);

View File

@ -262,7 +262,7 @@ QNetworkReply *Account::sendRawRequest(const QByteArray &verb, const QUrl &url,
SimpleNetworkJob *Account::sendRequest(const QByteArray &verb, const QUrl &url, QNetworkRequest req, QIODevice *data)
{
auto job = new SimpleNetworkJob(sharedFromThis(), this);
auto job = new SimpleNetworkJob(sharedFromThis());
job->startRequest(verb, url, req, data);
return job;
}