fix something

This commit is contained in:
2023-08-27 22:14:02 +08:00
parent 6837253a01
commit 8fce45b0b4
9 changed files with 211 additions and 118 deletions

View File

@ -78,6 +78,19 @@ namespace LibCmo::CK2 {
}
void CKContext::DestroyAllCKObjects() {
// free all created objects
for (auto& ptr : m_ObjectsList) {
if (ptr != nullptr) {
InternalDestroy(this, ptr);
}
}
// restore returned object list
m_ReturnedObjectIds.clear();
// empty object list
m_ObjectsList.clear();
}
#pragma endregion
#pragma region Ctor Dtor
@ -96,13 +109,7 @@ namespace LibCmo::CK2 {
}
CKContext::~CKContext() {
// free all created objects
for (auto& ptr : m_ObjectsList) {
if (ptr != nullptr) {
InternalDestroy(this, ptr);
}
}
DestroyAllCKObjects();
}
#pragma endregion