修复 Components 和 Scene 模块测试问题

1. GameObject 析构函数:从全局注册表移除自己,防止悬挂指针
2. SceneManager 测试:事件订阅后正确 Unsubscribe,防止 lambda 销毁后悬挂调用
3. SceneManager 测试:使用唯一场景名称避免覆盖问题
This commit is contained in:
2026-03-22 02:10:32 +08:00
parent 1358bb0a5a
commit 3357de85c9
2 changed files with 10 additions and 7 deletions

View File

@@ -22,6 +22,7 @@ GameObject::GameObject(const std::string& name)
}
GameObject::~GameObject() {
GetGlobalRegistry().erase(m_id);
if (m_transform) {
delete m_transform;
m_transform = nullptr;