diff --git a/CHANGELOG.md b/CHANGELOG.md index ca95b9b..a96ac3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Fix error spam when the add-on starts due to the thread safety checks added in Godot 4.1. + ## [1.1.1] - 2023-06-15 ### Fixed diff --git a/addons/debug_menu/debug_menu.gd b/addons/debug_menu/debug_menu.gd index cccdbe8..972a427 100644 --- a/addons/debug_menu/debug_menu.gd +++ b/addons/debug_menu/debug_menu.gd @@ -119,6 +119,14 @@ func _ready() -> void: settings.text = "Loading project information..." thread.start( func(): + # Disable thread safety checks as they interfere with this add-on. + # This only affects this particular thread, not other thread instances in the project. + # See for details. + # Use a Callable so that this can be ignored on Godot 4.0 without causing a script error + # (thread safety checks were added in Godot 4.1). + if Engine.get_version_info()["hex"] >= 0x040100: + Callable(Thread, "set_thread_safety_checks_enabled").call(false) + # Enable required time measurements to display CPU/GPU frame time information. # These lines are time-consuming operations, so run them in a separate thread. RenderingServer.viewport_set_measure_render_time(get_viewport().get_viewport_rid(), true)