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

Thread.start() suddenly doesn't accept NULL (either as default or specified) userdata variable? #51566

Closed
sszigeti opened this issue Aug 12, 2021 · 4 comments

Comments

@sszigeti
Copy link

sszigeti commented Aug 12, 2021

Godot version

3.4.beta3

System information

Windows 10

Issue description

I'm using Thread.start() to load static data for my game, like so:

var _thread = Thread.new()

func start_loading():
    _thread.start(self, "_load_my_data")

func _load_my_data(_unused_but_mandatory_thread_arg):
    # here I'm loading my data
    pass

This was working perfectly at least since 3.2, including 3.3.stable, however with 3.4.beta3 I get this error:

E 0:00:00.724   _start_func: Could not call function '_load_my_data' to start thread -8534501772636260605: Too Few Arguments.
  <C++ Error>   Method failed.
  <C++ Source>  core/bind/core_bind.cpp:2673 @ _start_func()

If I modify my code by specifying the 3rd argument for the Thread.start, the error doesn't show and my code completes as expected:

    _thread.start(self, "_load_my_data", 1)

Passing null (instead of 1) also invokes the error, so I'm guessing Thread.start's userdata argument no longer has a default null value, and/or no longer accepts a null value.

Steps to reproduce

Try to start a thread by only passing the first 2 mandatory arguments to Thread.start(). You'll find that now you also must pass a non-null 3rd argument.

Minimal reproduction project

Thread_start_3rd_arg_bug_demo.zip

@akien-mga
Copy link
Member

Just tested with #51574, this was fixed in #51385 (will be in 3.4 beta 4).

@RandomShaper
Copy link
Member

This should hav been fixed by #51093 + #51385 + their cherry-picks to 3.x. I don't know which of them made to the beta. Furthermore, I'm failing to find the cherry-pick of the latter in the 3.x branch.

@akien-mga
Copy link
Member

Furthermore, I'm failing to find the cherry-pick of the latter in the 3.x branch.

Yeah it was still queued in my local branch, now it's in #51574.

@RandomShaper
Copy link
Member

Oh, we did concurrent posting. 😀

Aside, I forgot that the cherry-pick mechanics are to create a batch of them. That explains why I couldn't find it.

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

No branches or pull requests

3 participants