Преглед изворни кода

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; }