Pārlūkot izejas kodu

Merge pull request #80432 from rsubtil/fix_linux_joypad_on_thread

Ensure `joy_connection_changed` is emitted on the main thread
Rémi Verschelde 2 gadi atpakaļ
vecāks
revīzija
5cfa9a0d7b
1 mainītis faili ar 2 papildinājumiem un 1 dzēšanām
  1. 2 1
      core/input/input.cpp

+ 2 - 1
core/input/input.cpp

@@ -475,7 +475,8 @@ void Input::joy_connection_changed(int p_idx, bool p_connected, String p_name, S
 	}
 	joy_names[p_idx] = js;
 
-	emit_signal(SNAME("joy_connection_changed"), p_idx, p_connected);
+	// Ensure this signal is emitted on the main thread, as some platforms (e.g. Linux) call this from a different thread.
+	call_deferred("emit_signal", SNAME("joy_connection_changed"), p_idx, p_connected);
 }
 
 Vector3 Input::get_gravity() const {