diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-09-12 04:37:08 +0200 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-09-12 04:37:08 +0200 |
commit | 77b69eb370e1cdbc33e44121f4f8483e19cad7d8 (patch) | |
tree | bebb2cd2b257a6d56995c29b5d9e37929f756263 /lib/mxcreply.cpp | |
parent | 2c61b463fa0608626a58aed79ebecb3bbd8c41d3 (diff) | |
download | libquotient-77b69eb370e1cdbc33e44121f4f8483e19cad7d8.tar.gz libquotient-77b69eb370e1cdbc33e44121f4f8483e19cad7d8.zip |
MxcReply: make sure to create a Private object
Diffstat (limited to 'lib/mxcreply.cpp')
-rw-r--r-- | lib/mxcreply.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/mxcreply.cpp b/lib/mxcreply.cpp index daa4af9a..0b6643fc 100644 --- a/lib/mxcreply.cpp +++ b/lib/mxcreply.cpp @@ -10,13 +10,16 @@ using namespace Quotient; class MxcReply::Private { public: - QNetworkReply *m_reply = nullptr; + explicit Private(QNetworkReply* r = nullptr) + : m_reply(r) + {} + QNetworkReply* m_reply; }; MxcReply::MxcReply(QNetworkReply* reply) + : d(std::make_unique<Private>(reply)) { reply->setParent(this); - d->m_reply = reply; connect(d->m_reply, &QNetworkReply::finished, this, [this]() { setError(d->m_reply->error(), d->m_reply->errorString()); setOpenMode(ReadOnly); @@ -25,10 +28,9 @@ MxcReply::MxcReply(QNetworkReply* reply) } MxcReply::MxcReply(QNetworkReply* reply, Room* room, const QString &eventId) - : d(std::make_unique<Private>()) + : d(std::make_unique<Private>(reply)) { reply->setParent(this); - d->m_reply = reply; connect(d->m_reply, &QNetworkReply::finished, this, [this, room, eventId]() { setError(d->m_reply->error(), d->m_reply->errorString()); setOpenMode(ReadOnly); |