From fda6c9a3d9aba971638ae2019f81bac321d000c5 Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Sun, 20 Nov 2022 15:03:36 +0300 Subject: [PATCH] Prevent object from being used after destruction PR #18031. --- src/base/rss/rss_feed.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/base/rss/rss_feed.cpp b/src/base/rss/rss_feed.cpp index de75bb367..c25f678cb 100644 --- a/src/base/rss/rss_feed.cpp +++ b/src/base/rss/rss_feed.cpp @@ -277,9 +277,11 @@ void Feed::handleParsingFinished(const RSS::Private::ParsingResult &result) void Feed::load() { - QMetaObject::invokeMethod(m_serializer, [this]() + QMetaObject::invokeMethod(m_serializer + , [serializer = m_serializer, url = m_url + , path = (m_session->dataFileStorage()->storageDir() / m_dataFileName)] { - m_serializer->load((m_session->dataFileStorage()->storageDir() / m_dataFileName), m_url); + serializer->load(path, url); }); } @@ -297,9 +299,11 @@ void Feed::store() for (Article *article :asConst(m_articles)) articlesData.push_back(article->data()); - QMetaObject::invokeMethod(m_serializer, [this, articlesData]() + QMetaObject::invokeMethod(m_serializer + , [articlesData, serializer = m_serializer + , path = (m_session->dataFileStorage()->storageDir() / m_dataFileName)] { - m_serializer->store((m_session->dataFileStorage()->storageDir() / m_dataFileName), articlesData); + serializer->store(path, articlesData); }); }