diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-05-19 08:54:00 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-05-19 08:54:00 +0900 |
commit | 626b2711a49e581babafd179ce362a1c88db8b85 (patch) | |
tree | c0752a7efbddb6f769165053aa6d0380748c2839 | |
parent | bb6d33182269425d98f7aa4e22aa5478cff57550 (diff) | |
download | libquotient-626b2711a49e581babafd179ce362a1c88db8b85.tar.gz libquotient-626b2711a49e581babafd179ce362a1c88db8b85.zip |
Connection: use QScopedPointer instead of unique_ptr
While theoretically less robust (no equivalent of make_unique),
QScopedPointer is navigable in Qt Creator debug views, unlike
unique_ptr. Of course this will eventually be fixed; but given that
inability to create an owning pointer object means sure abnormal
termination of our code shortly afterwards, having make_unique in this
particular case doesn't help in any way at all; so unique_ptr has zero
advantages over QScopedPointer in this setting.
-rw-r--r-- | lib/connection.cpp | 3 | ||||
-rw-r--r-- | lib/connection.h | 3 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp index cd0d96f7..e3da3c16 100644 --- a/lib/connection.cpp +++ b/lib/connection.cpp @@ -141,7 +141,7 @@ class Connection::Private Connection::Connection(const QUrl& server, QObject* parent) : QObject(parent) - , d(std::make_unique<Private>(std::make_unique<ConnectionData>(server))) + , d(new Private(std::make_unique<ConnectionData>(server))) { d->q = this; // All d initialization should occur before this line } @@ -294,6 +294,7 @@ void Connection::Private::connectWithToken(const QString& user, q->user(); // Creates a User object for the local user data->setToken(accessToken.toLatin1()); data->setDeviceId(deviceId); + q->setObjectName(userId % '/' % deviceId); qCDebug(MAIN) << "Using server" << data->baseUrl().toDisplayString() << "by user" << userId << "from device" << deviceId; emit q->stateChanged(); diff --git a/lib/connection.h b/lib/connection.h index 018c0459..cc2feed8 100644 --- a/lib/connection.h +++ b/lib/connection.h @@ -29,7 +29,6 @@ #include <QtCore/QDir> #include <functional> -#include <memory> namespace QMatrixClient { @@ -744,7 +743,7 @@ namespace QMatrixClient private: class Private; - std::unique_ptr<Private> d; + QScopedPointer<Private> d; /** * A single entry for functions that need to check whether the |