aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Plášil <me@rplasil.name>2017-09-04 10:35:45 +0800
committerRoman Plášil <me@rplasil.name>2017-09-04 10:35:45 +0800
commit56d34ecab5eb35c426a6e64b034bf2507761dd09 (patch)
tree0ae916e317c5adbfaf28db0d648f8aa8161f7547
parenta7ee0dfacc2c571572240191b3cf0846a9e32998 (diff)
downloadlibquotient-56d34ecab5eb35c426a6e64b034bf2507761dd09.tar.gz
libquotient-56d34ecab5eb35c426a6e64b034bf2507761dd09.zip
Use SyncJob::SyncData as a plain member
-rw-r--r--connection.cpp2
-rw-r--r--jobs/syncjob.cpp8
-rw-r--r--jobs/syncjob.h5
3 files changed, 4 insertions, 11 deletions
diff --git a/connection.cpp b/connection.cpp
index d2acf928..9fc2f85b 100644
--- a/connection.cpp
+++ b/connection.cpp
@@ -160,7 +160,7 @@ void Connection::sync(int timeout)
auto job = d->syncJob =
callApi<SyncJob>(d->data->lastEvent(), filter, timeout);
connect( job, &SyncJob::success, [=] () {
- onSyncSuccess(*job->data());
+ onSyncSuccess(job->data());
d->syncJob = nullptr;
emit syncDone();
});
diff --git a/jobs/syncjob.cpp b/jobs/syncjob.cpp
index bbec968e..062f1b15 100644
--- a/jobs/syncjob.cpp
+++ b/jobs/syncjob.cpp
@@ -28,7 +28,6 @@ SyncJob::SyncJob(const ConnectionData* connection, const QString& since,
const QString& filter, int timeout, const QString& presence)
: BaseJob(connection, HttpVerb::Get, QString("SyncJob-%1").arg(++jobId),
"_matrix/client/r0/sync")
- , d(new SyncData)
{
setLoggingCategory(SYNCJOB);
QUrlQuery query;
@@ -45,11 +44,6 @@ SyncJob::SyncJob(const ConnectionData* connection, const QString& since,
setMaxRetries(std::numeric_limits<int>::max());
}
-SyncJob::~SyncJob()
-{
- delete d;
-}
-
QString SyncData::nextBatch() const
{
return nextBatch_;
@@ -62,7 +56,7 @@ SyncDataList&& SyncData::takeRoomData()
BaseJob::Status SyncJob::parseJson(const QJsonDocument& data)
{
- return d->parseJson(data);
+ return d.parseJson(data);
}
BaseJob::Status SyncData::parseJson(const QJsonDocument &data) {
diff --git a/jobs/syncjob.h b/jobs/syncjob.h
index 16ac5895..80cc6735 100644
--- a/jobs/syncjob.h
+++ b/jobs/syncjob.h
@@ -86,14 +86,13 @@ namespace QMatrixClient
explicit SyncJob(const ConnectionData* connection, const QString& since = {},
const QString& filter = {},
int timeout = -1, const QString& presence = {});
- virtual ~SyncJob();
- SyncData *data() const { return d; }
+ SyncData &data() { return d; }
protected:
Status parseJson(const QJsonDocument& data) override;
private:
- SyncData* d;
+ SyncData d;
};
} // namespace QMatrixClient