Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Game frezes when call get_tree().quit() #22

Open
caioalcn opened this issue Dec 20, 2023 · 1 comment
Open

Game frezes when call get_tree().quit() #22

caioalcn opened this issue Dec 20, 2023 · 1 comment
Labels

Comments

@caioalcn
Copy link

caioalcn commented Dec 20, 2023

Hi,

Tested versions

Reproducible in:

  • Godot v4.2.1.stable.
  • Debug Menu v1.2.0

System information

Godot v4.2.1.stable - Windows 11 - v10.0.22631 Build 2263 - Vulkan API 1.3.260 - Forward+ - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce RTX 3050 6GB Laptop GPU

Issue description

When you call the method get_tree().quit() with the "debug menu" addon enabled the game freezes.

Minimal reproduction project (MRP)

test.zip

@Calinou Calinou added the bug label Dec 20, 2023
@Calinou
Copy link
Member

Calinou commented Dec 20, 2023

This is likely an issue with the thread that's used to request graphics driver version (as this is a slow operation, at least on Linux):

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 <https://github.com/godotengine/godot/pull/78000> 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)
update_information_label()
update_settings_label()
)
func _input(event: InputEvent) -> void:
if event.is_action_pressed("cycle_debug_menu"):
style = wrapi(style + 1, 0, Style.MAX) as Style
func _exit_tree() -> void:
thread.wait_to_finish()

This should ideally be fixed upstream so OS.get_video_adapter_driver_info() doesn't take as long on Linux (this should be profiled first with a debug build).

cc @Ark2000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants