Эх сурвалжийг харах

Fix serialization

- avoid bug: json object should be completely reassigned to avoid having old
content
Patrick-Christopher Mattulat 3 жил өмнө
parent
commit
ffca1087fe

+ 5 - 2
source/ls_std/serialization/json/logic/SerializableJSONState.cpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-09-15
- * Changed:         2020-11-06
+ * Changed:         2020-11-25
  *
  * */
 
@@ -72,8 +72,11 @@ void ls_std::SerializableJSONState::_unmarshalStateConnections()
 
 void ls_std::SerializableJSONState::_update()
 {
+  this->jsonObject = {
+      {"id", this->value->getId()}
+  };
+
   this->_updateStateConnections();
-  this->jsonObject["id"] = this->value->getId();
 }
 
 void ls_std::SerializableJSONState::_updateStateConnections()

+ 6 - 3
source/ls_std/serialization/json/logic/SerializableJSONStateMachine.cpp

@@ -3,7 +3,7 @@
  * Company:         Lynar Studios
  * E-Mail:          webmaster@lynarstudios.com
  * Created:         2020-09-17
- * Changed:         2020-11-06
+ * Changed:         2020-11-25
  *
  * */
 
@@ -49,9 +49,12 @@ void ls_std::SerializableJSONStateMachine::_unmarshalStates()
 
 void ls_std::SerializableJSONStateMachine::_update()
 {
+  this->jsonObject = {
+      {"memory", this->value->getMemory()},
+      {"name", this->value->getName()}
+  };
+
   this->_updateCurrentState();
-  this->jsonObject["memory"] = this->value->getMemory();
-  this->jsonObject["name"] = this->value->getName();
   this->_updateStates();
 }