Inventory: Don't throw resize lock exception in destructor (#13894)

... of nodemeta inventories.
This commit is contained in:
DS 2023-10-22 15:30:11 +02:00 committed by GitHub
parent 341e53f2e2
commit 7e8831a414
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -225,8 +225,13 @@ void NodeMetadataList::remove(v3s16 p)
{ {
NodeMetadata *olddata = get(p); NodeMetadata *olddata = get(p);
if (olddata) { if (olddata) {
if (m_is_metadata_owner) if (m_is_metadata_owner) {
// clearing can throw an exception due to the invlist resize lock,
// which we don't want to happen in the noexcept destructor
// => call clear before
olddata->clear();
delete olddata; delete olddata;
}
m_data.erase(p); m_data.erase(p);
} }
} }