diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-11-22 14:29:09 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-11-22 14:29:09 +0900 |
commit | f772058ab4d57c9503bb1e1e4354c246bde7cdb6 (patch) | |
tree | e393caddf81201cedba7df8b7e4ae0d0fc6b7b28 | |
parent | 795fa8c45bec3569cc74f02750d831031dbe29d1 (diff) | |
download | libquotient-f772058ab4d57c9503bb1e1e4354c246bde7cdb6.tar.gz libquotient-f772058ab4d57c9503bb1e1e4354c246bde7cdb6.zip |
Use unique_ptr for connectionData
-rw-r--r-- | connection.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/connection.cpp b/connection.cpp index 37d216d7..7aa2c4eb 100644 --- a/connection.cpp +++ b/connection.cpp @@ -46,15 +46,13 @@ class Connection::Private explicit Private(const QUrl& serverUrl) : q(nullptr) , data(new ConnectionData(serverUrl)) - , syncJob(nullptr) { } Q_DISABLE_COPY(Private) Private(Private&&) = delete; Private operator=(Private&&) = delete; - ~Private() { delete data; } Connection* q; - ConnectionData* data; + std::unique_ptr<ConnectionData> data; // A complex key below is a pair of room name and whether its // state is Invited. The spec mandates to keep Invited room state // separately so we should, e.g., keep objects for Invite and @@ -63,7 +61,7 @@ class Connection::Private QHash<QString, User*> userMap; QString userId; - SyncJob* syncJob; + SyncJob* syncJob = nullptr; bool cacheState = true; }; @@ -331,7 +329,7 @@ QHash< QPair<QString, bool>, Room* > Connection::roomMap() const const ConnectionData* Connection::connectionData() const { - return d->data; + return d->data.get(); } Room* Connection::provideRoom(const QString& id, JoinState joinState) |