aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--connection.cpp2
-rw-r--r--events/event.cpp3
-rw-r--r--events/event.h2
-rw-r--r--networkaccessmanager.cpp7
-rw-r--r--networkaccessmanager.h2
-rw-r--r--user.cpp5
6 files changed, 14 insertions, 7 deletions
diff --git a/connection.cpp b/connection.cpp
index 52fcc40b..7b72c592 100644
--- a/connection.cpp
+++ b/connection.cpp
@@ -599,7 +599,7 @@ Room* Connection::provideRoom(const QString& id, JoinState joinState)
{
qCDebug(MAIN) << "Deleting Invite state for room" << prevInvite->id();
emit aboutToDeleteRoom(prevInvite);
- delete prevInvite;
+ prevInvite->deleteLater();
}
}
diff --git a/events/event.cpp b/events/event.cpp
index b55c44c4..74a2c3d7 100644
--- a/events/event.cpp
+++ b/events/event.cpp
@@ -120,7 +120,8 @@ RoomEvent::RoomEvent(Type type, const QJsonObject& rep)
auto redaction = unsignedData.value("redacted_because");
if (redaction.isObject())
{
- _redactedBecause.reset(new RedactionEvent(redaction.toObject()));
+ _redactedBecause =
+ std::make_unique<RedactionEvent>(redaction.toObject());
return;
}
diff --git a/events/event.h b/events/event.h
index 4bd08b55..f0ca2d15 100644
--- a/events/event.h
+++ b/events/event.h
@@ -100,7 +100,7 @@ namespace QMatrixClient
{
auto e = _impl::doMakeEvent<EventT>(obj);
if (!e)
- e.reset(new EventT(EventType::Unknown, obj));
+ e = std::make_unique<EventT>(EventType::Unknown, obj);
return e;
}
diff --git a/networkaccessmanager.cpp b/networkaccessmanager.cpp
index 7fb2f602..89967a8a 100644
--- a/networkaccessmanager.cpp
+++ b/networkaccessmanager.cpp
@@ -19,6 +19,7 @@
#include "networkaccessmanager.h"
#include <QtNetwork/QNetworkReply>
+#include <QtCore/QCoreApplication>
using namespace QMatrixClient;
@@ -28,7 +29,7 @@ class NetworkAccessManager::Private
QList<QSslError> ignoredSslErrors;
};
-NetworkAccessManager::NetworkAccessManager() : d(std::make_unique<Private>())
+NetworkAccessManager::NetworkAccessManager(QObject* parent) : d(std::make_unique<Private>())
{ }
QList<QSslError> NetworkAccessManager::ignoredSslErrors() const
@@ -48,7 +49,7 @@ void NetworkAccessManager::clearIgnoredSslErrors()
static NetworkAccessManager* createNam()
{
- auto nam = new NetworkAccessManager;
+ auto nam = new NetworkAccessManager(QCoreApplication::instance());
// See #109. Once Qt bearer management gets better, this workaround
// should become unnecessary.
nam->connect(nam, &QNetworkAccessManager::networkAccessibleChanged,
@@ -56,7 +57,7 @@ static NetworkAccessManager* createNam()
return nam;
}
-NetworkAccessManager*NetworkAccessManager::instance()
+NetworkAccessManager* NetworkAccessManager::instance()
{
static auto* nam = createNam();
return nam;
diff --git a/networkaccessmanager.h b/networkaccessmanager.h
index ea08c591..ae847582 100644
--- a/networkaccessmanager.h
+++ b/networkaccessmanager.h
@@ -28,7 +28,7 @@ namespace QMatrixClient
{
Q_OBJECT
public:
- NetworkAccessManager();
+ NetworkAccessManager(QObject* parent = nullptr);
~NetworkAccessManager() override;
QList<QSslError> ignoredSslErrors() const;
diff --git a/user.cpp b/user.cpp
index 9cdbb420..308b217c 100644
--- a/user.cpp
+++ b/user.cpp
@@ -48,6 +48,11 @@ class User::Private
Private(QString userId, Connection* connection)
: userId(move(userId)), connection(connection)
{ }
+ ~Private()
+ {
+ for (auto a: otherAvatars)
+ delete a;
+ }
QString userId;
Connection* connection;