From edc79e48cc6ae6671ebfdc01de05b55105b844b0 Mon Sep 17 00:00:00 2001 From: Jupeyy Date: Mon, 4 Jul 2022 18:24:34 +0200 Subject: [PATCH] Fix skindownload by only allowing move assignments --- src/game/client/components/skins.cpp | 2 +- src/game/client/components/skins.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/game/client/components/skins.cpp b/src/game/client/components/skins.cpp index d00f4126f..d44350b7f 100644 --- a/src/game/client/components/skins.cpp +++ b/src/game/client/components/skins.cpp @@ -450,6 +450,6 @@ int CSkins::FindImpl(const char *pName) str_format(Skin.m_aPath, sizeof(Skin.m_aPath), "downloadedskins/%s", IStorage::FormatTmpPath(aBuf, sizeof(aBuf), pName)); Skin.m_pTask = std::make_shared(this, aUrl, Storage(), Skin.m_aPath); m_pClient->Engine()->AddJob(Skin.m_pTask); - m_vDownloadSkins.insert(std::lower_bound(m_vDownloadSkins.begin(), m_vDownloadSkins.end(), Skin), Skin); + m_vDownloadSkins.insert(std::lower_bound(m_vDownloadSkins.begin(), m_vDownloadSkins.end(), Skin), std::move(Skin)); return -1; } diff --git a/src/game/client/components/skins.h b/src/game/client/components/skins.h index 683b23be1..f05f8891f 100644 --- a/src/game/client/components/skins.h +++ b/src/game/client/components/skins.h @@ -29,6 +29,9 @@ public: char m_aPath[IO_MAX_PATH_LENGTH]; char m_aName[24]; + CDownloadSkin(CDownloadSkin &&Other) = default; + CDownloadSkin() = default; + ~CDownloadSkin() { if(m_pTask) @@ -37,6 +40,8 @@ public: bool operator<(const CDownloadSkin &Other) const { return str_comp(m_aName, Other.m_aName) < 0; } bool operator<(const char *pOther) const { return str_comp(m_aName, pOther) < 0; } bool operator==(const char *pOther) const { return !str_comp(m_aName, pOther); } + + CDownloadSkin &operator=(CDownloadSkin &&Other) = default; }; typedef std::function TSkinLoadedCBFunc;