From 8e5c177f545bf6a0c6b56544c7e08dbf383e3f7e Mon Sep 17 00:00:00 2001 From: Ricardo Subtil Date: Tue, 8 Aug 2023 21:51:33 +0100 Subject: [PATCH] Ensure `joy_connection_changed` is emitted on the main thread (cherry picked from commit 1bb73b0689a9cc2731eee63374f07e08b35b6e6a) --- main/input_default.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main/input_default.cpp b/main/input_default.cpp index 401633e8b5d..8a0635c5f44 100644 --- a/main/input_default.cpp +++ b/main/input_default.cpp @@ -282,8 +282,9 @@ void InputDefault::joy_connection_changed(int p_idx, bool p_connected, String p_ }; joy_names[p_idx] = js; - emit_signal("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", "joy_connection_changed", p_idx, p_connected); +} Vector3 InputDefault::get_gravity() const { _THREAD_SAFE_METHOD_