mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 19:44:55 +00:00
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:
@@ -7,7 +7,8 @@ namespace urde {
|
||||
static logvisor::Module Log("CResFactory");
|
||||
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user