-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Fix simPlotPoints causing crash randomly #2963
Conversation
8479203
to
cc0091b
Compare
Good catch, I think this should fix it. |
Great, thanks for the review @madratman |
cc0091b
to
eec7c6e
Compare
Fixes random crashes on usage Plus some general cleanup
I've added some more cleanups like creating the |
for (int idx = 0; idx < points.size(); idx += 2) | ||
{ | ||
DrawDebugLine(simmode_->GetWorld(), simmode_->getGlobalNedTransform().fromGlobalNed(points[idx]), simmode_->getGlobalNedTransform().fromGlobalNed(points[idx+1]), color.ToFColor(true), is_persistent, duration, 0, thickness); | ||
} | ||
UAirBlueprintLib::RunCommandOnGameThread([this, &points, &color, thickness, duration, is_persistent]() { | ||
for (int idx = 0; idx < points.size()-1; idx += 2) { | ||
DrawDebugLine(simmode_->GetWorld(), | ||
simmode_->getGlobalNedTransform().fromGlobalNed(points[idx]), | ||
simmode_->getGlobalNedTransform().fromGlobalNed(points[idx+1]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a slight behavioural change here, index limit is decreased since earlier, it could crash when odd number of points are given
This fixes that, the last point will be ignored if odd no. of points are passed
Thanks for merging! Will try to add some scripts and docs as a future PR |
Running DrawDebugPoint on GameThread seems to fix the problem
Script -
Without running on game thread specifically, it runs generally for 100 or even 1k calls, but always crashes when using 10k calls.
If this does fix the problem, then will probably need to update all the plot APIs
Thanks to @TomAvrech for reporting the issue and testing!
Fixes #2959
TODO:
A question arose as to why something like this isn't required for DrawDebugPoints in Lidar, Distance Sensor (Maybe cause
Tick
runs in game thread)