Solve memory leak when fetching feeds

This commit is contained in:
Bart De Vries 2021-10-26 22:32:58 +02:00
parent 710f44d2ef
commit 4f83ac8701
1 changed files with 5 additions and 3 deletions

View File

@ -39,8 +39,10 @@ void UpdateFeedJob::start()
void UpdateFeedJob::retrieveFeed()
{
if (m_abort)
if (m_abort) {
emitResult();
return;
}
qCDebug(kastsFetcher) << "Starting to fetch" << m_url;
Q_EMIT feedUpdateStatusChanged(m_url, true);
@ -58,8 +60,8 @@ void UpdateFeedJob::retrieveFeed()
setErrorText(m_reply->errorString());
} else {
QByteArray data = m_reply->readAll();
Syndication::DocumentSource *document = new Syndication::DocumentSource(data, m_url);
Syndication::FeedPtr feed = Syndication::parserCollection()->parse(*document, QStringLiteral("Atom"));
Syndication::DocumentSource document(data, m_url);
Syndication::FeedPtr feed = Syndication::parserCollection()->parse(document, QStringLiteral("Atom"));
processFeed(feed);
}
Q_EMIT feedUpdateStatusChanged(m_url, false);