Quellcode durchsuchen

Fix InputMap and display server not nulling singleton on free

Paulb23 vor 4 Jahren
Ursprung
Commit
d186862338
3 geänderte Dateien mit 6 neuen und 0 gelöschten Zeilen
  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;
 }