1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-11 15:27:54 +00:00

Rely on Qt ownership to free resources

The m_reply has already changed parent in
DownloadHandlerImpl::assignNetworkReply() and thus we can rely on Qt
ownership to delete the object.
This commit is contained in:
Chocobo1 2020-03-25 11:56:07 +08:00
parent fbf325c6d6
commit 9630e7b689
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
2 changed files with 1 additions and 6 deletions

View File

@ -64,11 +64,6 @@ DownloadHandlerImpl::DownloadHandlerImpl(Net::DownloadManager *manager, const Ne
m_result.status = Net::DownloadStatus::Success;
}
DownloadHandlerImpl::~DownloadHandlerImpl()
{
delete m_reply;
}
void DownloadHandlerImpl::cancel()
{
if (m_reply) {
@ -83,6 +78,7 @@ void DownloadHandlerImpl::cancel()
void DownloadHandlerImpl::assignNetworkReply(QNetworkReply *reply)
{
Q_ASSERT(reply);
Q_ASSERT(!m_reply);
m_reply = reply;
m_reply->setParent(this);

View File

@ -43,7 +43,6 @@ class DownloadHandlerImpl : public Net::DownloadHandler
public:
DownloadHandlerImpl(Net::DownloadManager *manager, const Net::DownloadRequest &downloadRequest);
~DownloadHandlerImpl() override;
void cancel() override;