Browse Source

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

... of nodemeta inventories.
DS 6 months ago
parent
commit
7e8831a414
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/nodemetadata.cpp

+ 6 - 1
src/nodemetadata.cpp

@@ -225,8 +225,13 @@ void NodeMetadataList::remove(v3s16 p)
 {
 	NodeMetadata *olddata = get(p);
 	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;
+		}
 		m_data.erase(p);
 	}
 }