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