From b49987e8767b4d0076d62033b019507a8cbc801c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Tue, 23 Nov 2021 01:25:24 +0100 Subject: [PATCH] NOISSUE fix fix fix the accounts again --- launcher/QObjectPtr.h | 6 ++++++ launcher/minecraft/auth/flows/Yggdrasil.cpp | 1 + launcher/minecraft/services/CapeChange.cpp | 4 ++-- launcher/minecraft/services/CapeChange.h | 3 ++- launcher/minecraft/services/SkinDelete.cpp | 2 +- launcher/minecraft/services/SkinDelete.h | 5 ++--- launcher/minecraft/services/SkinUpload.cpp | 2 +- launcher/minecraft/services/SkinUpload.h | 4 ++-- 8 files changed, 17 insertions(+), 10 deletions(-) diff --git a/launcher/QObjectPtr.h b/launcher/QObjectPtr.h index 0ff51136..57974939 100644 --- a/launcher/QObjectPtr.h +++ b/launcher/QObjectPtr.h @@ -77,6 +77,12 @@ public: { return m_ptr; } + bool operator==(const shared_qobject_ptr& other) { + return m_ptr == other.m_ptr; + } + bool operator!=(const shared_qobject_ptr& other) { + return m_ptr != other.m_ptr; + } private: std::shared_ptr m_ptr; diff --git a/launcher/minecraft/auth/flows/Yggdrasil.cpp b/launcher/minecraft/auth/flows/Yggdrasil.cpp index f5622418..5ea168e8 100644 --- a/launcher/minecraft/auth/flows/Yggdrasil.cpp +++ b/launcher/minecraft/auth/flows/Yggdrasil.cpp @@ -22,6 +22,7 @@ #include #include #include + #include #include "Application.h" diff --git a/launcher/minecraft/services/CapeChange.cpp b/launcher/minecraft/services/CapeChange.cpp index e24818ad..d411965a 100644 --- a/launcher/minecraft/services/CapeChange.cpp +++ b/launcher/minecraft/services/CapeChange.cpp @@ -18,7 +18,7 @@ void CapeChange::setCape(QString& cape) { setStatus(tr("Equipping cape")); - m_reply = std::shared_ptr(rep); + m_reply = shared_qobject_ptr(rep); connect(rep, &QNetworkReply::uploadProgress, this, &Task::setProgress); connect(rep, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(downloadError(QNetworkReply::NetworkError))); connect(rep, SIGNAL(finished()), this, SLOT(downloadFinished())); @@ -32,7 +32,7 @@ void CapeChange::clearCape() { setStatus(tr("Removing cape")); - m_reply = std::shared_ptr(rep); + m_reply = shared_qobject_ptr(rep); connect(rep, &QNetworkReply::uploadProgress, this, &Task::setProgress); connect(rep, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(downloadError(QNetworkReply::NetworkError))); connect(rep, SIGNAL(finished()), this, SLOT(downloadFinished())); diff --git a/launcher/minecraft/services/CapeChange.h b/launcher/minecraft/services/CapeChange.h index 1b6f2f72..c04ad8c7 100644 --- a/launcher/minecraft/services/CapeChange.h +++ b/launcher/minecraft/services/CapeChange.h @@ -5,6 +5,7 @@ #include #include #include "tasks/Task.h" +#include "QObjectPtr.h" class CapeChange : public Task { @@ -20,7 +21,7 @@ private: private: QString m_capeId; AuthSessionPtr m_session; - std::shared_ptr m_reply; + shared_qobject_ptr m_reply; protected: virtual void executeTask(); diff --git a/launcher/minecraft/services/SkinDelete.cpp b/launcher/minecraft/services/SkinDelete.cpp index 7638ca1c..a0b0330c 100644 --- a/launcher/minecraft/services/SkinDelete.cpp +++ b/launcher/minecraft/services/SkinDelete.cpp @@ -15,7 +15,7 @@ void SkinDelete::executeTask() QNetworkRequest request(QUrl("https://api.minecraftservices.com/minecraft/profile/skins/active")); request.setRawHeader("Authorization", QString("Bearer %1").arg(m_session->access_token).toLocal8Bit()); QNetworkReply *rep = APPLICATION->network()->deleteResource(request); - m_reply = std::shared_ptr(rep); + m_reply = shared_qobject_ptr(rep); setStatus(tr("Deleting skin")); connect(rep, &QNetworkReply::uploadProgress, this, &Task::setProgress); diff --git a/launcher/minecraft/services/SkinDelete.h b/launcher/minecraft/services/SkinDelete.h index 839bf9bc..6048b33a 100644 --- a/launcher/minecraft/services/SkinDelete.h +++ b/launcher/minecraft/services/SkinDelete.h @@ -2,11 +2,10 @@ #include #include -#include #include #include "tasks/Task.h" -typedef std::shared_ptr SkinDeletePtr; +typedef shared_qobject_ptr SkinDeletePtr; class SkinDelete : public Task { @@ -17,7 +16,7 @@ public: private: AuthSessionPtr m_session; - std::shared_ptr m_reply; + shared_qobject_ptr m_reply; protected: virtual void executeTask(); diff --git a/launcher/minecraft/services/SkinUpload.cpp b/launcher/minecraft/services/SkinUpload.cpp index d2d234bf..e58d32d7 100644 --- a/launcher/minecraft/services/SkinUpload.cpp +++ b/launcher/minecraft/services/SkinUpload.cpp @@ -40,7 +40,7 @@ void SkinUpload::executeTask() multiPart->append(model); QNetworkReply *rep = APPLICATION->network()->post(request, multiPart); - m_reply = std::shared_ptr(rep); + m_reply = shared_qobject_ptr(rep); setStatus(tr("Uploading skin")); connect(rep, &QNetworkReply::uploadProgress, this, &Task::setProgress); diff --git a/launcher/minecraft/services/SkinUpload.h b/launcher/minecraft/services/SkinUpload.h index ec859699..2c782e11 100644 --- a/launcher/minecraft/services/SkinUpload.h +++ b/launcher/minecraft/services/SkinUpload.h @@ -6,7 +6,7 @@ #include #include "tasks/Task.h" -typedef std::shared_ptr SkinUploadPtr; +typedef shared_qobject_ptr SkinUploadPtr; class SkinUpload : public Task { @@ -26,7 +26,7 @@ private: Model m_model; QByteArray m_skin; AuthSessionPtr m_session; - std::shared_ptr m_reply; + shared_qobject_ptr m_reply; protected: virtual void executeTask();