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

Fix Unreal crashing when deleting an actor with a JSBMovement component. #1212

Merged
merged 1 commit into from
Dec 30, 2024

Conversation

fadak0828
Copy link
Contributor

Below is the crash log that occurred.

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000000000000ac

UnrealEditor_JSBSimFlightDynamicsModelEditor!FJSBSimMovementCompVisualizer::DrawVisualization() [C:\workspace\jsbsim\UnrealEngine\Plugins\JSBSimFlightDynamicsModel\Source\JSBSimFlightDynamicsModelEditor\Private\JSBSimMovementCompVisualizer.cpp:55]
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor_Renderer
UnrealEditor_Renderer
UnrealEditor_Renderer
UnrealEditor_Renderer
UnrealEditor_Renderer
UnrealEditor_UnrealEd
UnrealEditor_Engine
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
kernel32
ntdll

@gallonmate
Copy link
Contributor

Thanks. I can confirm that in UE5.4 this is broken.
I added a review/change request in your solution, because only one check is needed to prevent crashing. The three checks per function seem unnecessary and after looking at Unreal Engine source code, they also only use one check by using a single if at the beginning. For example:

void FSplineComponentVisualizer::DrawVisualization(const UActorComponent* Componen,.....
{
	if (const USplineComponent* SplineComp = Cast<const USplineComponent>(Component))
	{
               
        )    

Copy link
Contributor

@gallonmate gallonmate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The if (!movementComponent) is good. The other checks can be removed.

Add null check to JSBSimMovementCompVisualizer.cpp
@fadak0828
Copy link
Contributor Author

The if (!movementComponent) is good. The other checks can be removed.

Thanks for the very quick review. I agree with your comment and fixed the code.

Copy link

codecov bot commented Dec 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 24.96%. Comparing base (318c804) to head (30cfc80).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1212   +/-   ##
=======================================
  Coverage   24.96%   24.96%           
=======================================
  Files         170      170           
  Lines       19281    19281           
=======================================
  Hits         4814     4814           
  Misses      14467    14467           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bcoconni bcoconni merged commit 330a6e3 into JSBSim-Team:master Dec 30, 2024
29 checks passed
@bcoconni
Copy link
Member

Merged.
Thanks @fadak0828 for the PR.
Thanks @gallonmate for the review.

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

Successfully merging this pull request may close these issues.

3 participants