浏览代码

Leak memory to avoid crashes

We really shouldn't be doing this, but something about freeing
KeyValues is causing issues.
nosoop 1 年之前
父节点
当前提交
239ee13908
共有 2 个文件被更改,包括 4 次插入5 次删除
  1. 0 2
      econmanager.cpp
  2. 4 3
      econmanager.h

+ 0 - 2
econmanager.cpp

@@ -118,8 +118,6 @@ bool CEconManager::InsertOrReplaceAttribute(KeyValues *pAttribKV) {
 }
 
 bool CEconManager::RegisterAttribute(KeyValues* pAttribKV) {
-	// for some reason any KV pointers we store blows up
-	// don't have the energy to deal with this shit
 	AutoKeyValues kv{pAttribKV->MakeCopy()};
 	std::string attrName = kv->GetString("name");
 	this->m_RegisteredAttributes[attrName] = std::move(kv);

+ 4 - 3
econmanager.h

@@ -53,9 +53,10 @@ class AutoKeyValues {
 	AutoKeyValues(const AutoKeyValues &other) : m_pKeyValues{other.m_pKeyValues->MakeCopy()} {}
 	
 	~AutoKeyValues() {
-		if (m_pKeyValues) {
-			m_pKeyValues->deleteThis();
-		}
+		// TODO: figure out why doing this blows up the server
+		// if (m_pKeyValues) {
+			// m_pKeyValues->deleteThis();
+		// }
 	}
 	
 	KeyValues *operator->() const { return m_pKeyValues; }