-
-
Notifications
You must be signed in to change notification settings - Fork 20.1k
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
Crash when using get_gravity
from _process
while running physics on separate thread
#87975
Comments
I'm on it |
I appreciate that an error is preferable to a crash, but this maybe wasn't the fix I had hoped for. :) I'll make a new issue for the error I guess. |
This matches the rest of the code, wasn't going to add an additional error originally But you can't avoid an error entirely, what is the issue you're facing with the error? What is your alternative? A more elaborate fix wouldn't be appropriate I'd say as it's a crash that must be avoided, improvements on it would be separate, but unless you suggest adding a more elaborate caching etc., there should always be an error here when accessed incorrectly |
Fair enough. Maybe creating an issue wasn't the right tool to use here. Ideally I wouldn't have fumbled the review of #84640 and this could've been discussed prior to merging this change, but alas. I agree that your fix was the pragmatic fix in this case, and lines up with how (Also, I didn't mean for my previous comment to come off as snarky as it did. I appreciate the quick fix, of course.) |
Thank you! Making a report was the appropriate thing to make sure the crash was resolved, that shouldn't have been left untended to, but a broader improvement would be good to discuss too :) |
Tested versions
Reproducible in: 4.3-dev [acde2a8]
System information
Windows 11 (10.0.22631)
Issue description
The new
get_gravity
method that was added in #84640 relies onbody_get_direct_state
, which is not accessible outside of_physics_process
and_integrate_forces
when using thephysics/*d/run_on_separate_thread
project setting.As such, it ends up throwing an error here:
godot/servers/physics_3d/godot_physics_server_3d.cpp
Line 924 in 63d6bda
... and subsequently crashes due to a
nullptr
access inget_gravity
.Steps to reproduce
Minimal reproduction project (MRP)
GravityCrash.zip
The text was updated successfully, but these errors were encountered: