Skip to content

Commit

Permalink
fix: properly cleanup network replies on destruction
Browse files Browse the repository at this point in the history
  • Loading branch information
Bionus committed Nov 14, 2022
1 parent b49e35d commit 09c6edf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib/src/network/network-reply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ NetworkReply::NetworkReply(QNetworkRequest request, QByteArray data, CustomNetwo
init();
}

NetworkReply::~NetworkReply()
{
abort();

m_reply->deleteLater();
m_reply = nullptr;
}


void NetworkReply::init()
{
timer.setSingleShot(true);
Expand Down
2 changes: 2 additions & 0 deletions src/lib/src/network/network-reply.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class NetworkReply : public QObject

NetworkReply(QNetworkRequest request, CustomNetworkAccessManager *manager, QObject *parent = nullptr);
NetworkReply(QNetworkRequest request, QByteArray data, CustomNetworkAccessManager *manager, QObject *parent = nullptr);
~NetworkReply();

QUrl url() const;
QVariant attribute(QNetworkRequest::Attribute code) const;
QByteArray readAll();
Expand Down

0 comments on commit 09c6edf

Please sign in to comment.