mirror of https://github.com/AxioDL/metaforce.git
CResFactory: Resolve use-after-move in AddToLoadList()
The behavior on the right hand side would occur before the actual assignment, making the tag value invalidated. Instead, we copy the tag before the move is performed to keep the data valid when inserting it into the map.
This commit is contained in:
parent
4daa8ac374
commit
0a47e623fd
|
@ -7,7 +7,8 @@ namespace urde {
|
||||||
static logvisor::Module Log("CResFactory");
|
static logvisor::Module Log("CResFactory");
|
||||||
|
|
||||||
void CResFactory::AddToLoadList(SLoadingData&& data) {
|
void CResFactory::AddToLoadList(SLoadingData&& data) {
|
||||||
m_loadMap[data.x0_tag] = m_loadList.insert(m_loadList.end(), std::move(data));
|
const SObjectTag tag = data.x0_tag;
|
||||||
|
m_loadMap.insert_or_assign(tag, m_loadList.insert(m_loadList.end(), std::move(data)));
|
||||||
}
|
}
|
||||||
|
|
||||||
CFactoryFnReturn CResFactory::BuildSync(const SObjectTag& tag, const CVParamTransfer& xfer, CObjectReference* selfRef) {
|
CFactoryFnReturn CResFactory::BuildSync(const SObjectTag& tag, const CVParamTransfer& xfer, CObjectReference* selfRef) {
|
||||||
|
|
Loading…
Reference in New Issue