浏览代码

Fix InputMap and display server not nulling singleton on free

Paulb23 4 年之前
父节点
当前提交
d186862338
共有 3 个文件被更改,包括 6 次插入0 次删除
  1. 4 0
      core/input/input_map.cpp
  2. 1 0
      core/input/input_map.h
  3. 1 0
      servers/display_server.cpp

+ 4 - 0
core/input/input_map.cpp

@@ -746,3 +746,7 @@ InputMap::InputMap() {
 	ERR_FAIL_COND_MSG(singleton, "Singleton in InputMap already exist.");
 	singleton = this;
 }
+
+InputMap::~InputMap() {
+	singleton = nullptr;
+}

+ 1 - 0
core/input/input_map.h

@@ -95,6 +95,7 @@ public:
 	const OrderedHashMap<String, List<Ref<InputEvent>>> &get_builtins();
 
 	InputMap();
+	~InputMap();
 };
 
 #endif // INPUT_MAP_H

+ 1 - 0
servers/display_server.cpp

@@ -605,4 +605,5 @@ DisplayServer::DisplayServer() {
 }
 
 DisplayServer::~DisplayServer() {
+	singleton = nullptr;
 }