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

Negative delay freeze Godot #46190

Closed
qarmin opened this issue Feb 18, 2021 · 4 comments · Fixed by #46194
Closed

Negative delay freeze Godot #46190

qarmin opened this issue Feb 18, 2021 · 4 comments · Fixed by #46194

Comments

@qarmin
Copy link
Contributor

qarmin commented Feb 18, 2021

Godot version:
Godot 3.2.4 rc 2

OS
Ubuntu 20.04 - Ubuntu 3.36 X11

Issue description:
Executing

OS.delay_usec(-1)

or

OS.delay_msec(-1)

freeze entire Godot

@Calinou
Copy link
Member

Calinou commented Feb 18, 2021

This is probably because the value is expected to be unsigned and overflows, resulting in a very long delay.

@akien-mga
Copy link
Member

Yeah it can likely be considered working as intended... but I guess we can ERR_FAIL if the parameter is negative to prevent this, we don't have to support unsigned int wrapping as a feature here.

@Calinou
Copy link
Member

Calinou commented Feb 18, 2021

The parameter is an uint32_t, so how can we detect whether it was actually passed as a negative value? Checking p_usec < 0 won't do the job (I just tried).

Maybe we could change it to be an int32_t. This will halve the maximum value you can use but I doubt this has any practical bearing.

@akien-mga
Copy link
Member

Maybe bind the scripting method to a proxy _delay_usec(int p_delay) that does the check and calls the original method, so it's still available for C++ with proper type checks.

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

Successfully merging a pull request may close this issue.

3 participants