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 CSGShape debug_collision_shape crash #84338

Merged
merged 1 commit into from
Nov 2, 2023

Conversation

smix8
Copy link
Contributor

@smix8 smix8 commented Nov 2, 2023

Fixes CSGShape debug_collision_shape crash.

Fixes #84304

While the immediate crash source was root_collision_shape being null I also do not trust a function that does not guard itself against crashes from e.g. get_world_3d() or get_global_transform(). In fact the only guard was a well-meaning comment.

@smix8 smix8 added this to the 4.2 milestone Nov 2, 2023
@smix8 smix8 requested a review from a team as a code owner November 2, 2023 01:43
Copy link
Contributor

@jsjtxietian jsjtxietian left a comment

Choose a reason for hiding this comment

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

What about print some warning with the origin comment as it's content ?

Fixes CSGShape debug_collision_shape crash.
@smix8
Copy link
Contributor Author

smix8 commented Nov 2, 2023

What about print some warning with the origin comment as it's content ?

I am not sure. Do people benefit from a printed warning here about this?

The original comment was a code comment, not directed or with useful information for engine users in particular, and now the if check basically tells the same story.

Copy link
Member

@AThousandShips AThousandShips left a comment

Choose a reason for hiding this comment

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

Haven't verified but should cover the cases (the validity of get_world_3d should be covered by the is_inside_tree check, but might be incomplete)

Copy link
Contributor

@YuriSizov YuriSizov left a comment

Choose a reason for hiding this comment

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

Seems in line with other checks in this class, if not a bit excessive.

@YuriSizov YuriSizov merged commit bd7f65f into godotengine:master Nov 2, 2023
15 checks passed
@YuriSizov
Copy link
Contributor

Thanks!

@smix8 smix8 deleted the csg_debug_crash branch November 3, 2023 02:56
@AThousandShips AThousandShips added the cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release label Mar 19, 2024
@AThousandShips
Copy link
Member

@AThousandShips AThousandShips added cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release and removed cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release labels Mar 19, 2024
@akien-mga akien-mga changed the title Fix CSGShape debug_collision_shape crash Fix CSGShape debug_collision_shape crash Apr 8, 2024
@akien-mga
Copy link
Member

Cherry-picked for 4.1.4.

@akien-mga akien-mga added topic:3d and removed cherrypick:4.1 Considered for cherry-picking into a future 4.1.x release labels Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Making a CSG Mesh visible again crashes Godot 4.2 beta4
5 participants