diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-05-30 15:41:56 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-05-30 15:41:56 +0200 |
commit | be2c5e66f44df2a49a3238434c06ad33a212e544 (patch) | |
tree | 95f2af3924ef54a4afde292ba9ecf8512ec69ba0 | |
parent | af249e84d940432f596dcde5cf4afb2a1bc45a79 (diff) | |
parent | 2c9df769adfb9824dbdf9c5355aa9f7e16438066 (diff) | |
download | redot-engine-be2c5e66f44df2a49a3238434c06ad33a212e544.tar.gz |
Merge pull request #92201 from bruvzg/input_flush
Clean `Input::frame_parsed_events` before de-initialising scripting languages to ensure no script created events exist at the exit.
-rw-r--r-- | core/input/input.cpp | 8 | ||||
-rw-r--r-- | core/input/input.h | 3 | ||||
-rw-r--r-- | main/main.cpp | 6 |
3 files changed, 17 insertions, 0 deletions
diff --git a/core/input/input.cpp b/core/input/input.cpp index ec70e545ef..aa4b47934e 100644 --- a/core/input/input.cpp +++ b/core/input/input.cpp @@ -1029,6 +1029,14 @@ void Input::parse_input_event(const Ref<InputEvent> &p_event) { } } +#ifdef DEBUG_ENABLED +void Input::flush_frame_parsed_events() { + _THREAD_SAFE_METHOD_ + + frame_parsed_events.clear(); +} +#endif + void Input::flush_buffered_events() { _THREAD_SAFE_METHOD_ diff --git a/core/input/input.h b/core/input/input.h index 6e7ab43082..4daea0c9e8 100644 --- a/core/input/input.h +++ b/core/input/input.h @@ -363,6 +363,9 @@ public: Dictionary get_joy_info(int p_device) const; void set_fallback_mapping(const String &p_guid); +#ifdef DEBUG_ENABLED + void flush_frame_parsed_events(); +#endif void flush_buffered_events(); bool is_using_input_buffering(); void set_use_input_buffering(bool p_enable); diff --git a/main/main.cpp b/main/main.cpp index 2bd421e5af..6b17c55efc 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -4182,6 +4182,12 @@ void Main::cleanup(bool p_force) { ERR_FAIL_COND(!_start_success); } +#ifdef DEBUG_ENABLED + if (input) { + input->flush_frame_parsed_events(); + } +#endif + for (int i = 0; i < TextServerManager::get_singleton()->get_interface_count(); i++) { TextServerManager::get_singleton()->get_interface(i)->cleanup(); } |