修复 Components 和 Scene 模块测试问题
1. GameObject 析构函数:从全局注册表移除自己,防止悬挂指针 2. SceneManager 测试:事件订阅后正确 Unsubscribe,防止 lambda 销毁后悬挂调用 3. SceneManager 测试:使用唯一场景名称避免覆盖问题
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user