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 crash when previewing a scene with a mesh as the root node #87781

Merged
merged 1 commit into from
Feb 7, 2024

Conversation

aaronfranke
Copy link
Member

This PR fixes a crash that happens during an edge case where the imported scene's root node is a mesh. The code replaces each ImporterMeshInstance3D node with a MeshInstance3D, but in the case of the scene root, the reference to the scene was being left as a dangling pointer. Now it sets the scene to the new root node. Also I added a comment.

I have used unlikely here because this check will only be true at most once for each file and usually 0 times.

Test file: crashlight.glb.zip

In master: crash

With this PR:
Screenshot 2024-01-31 at 6 19 00 AM

@akien-mga akien-mga merged commit bc9acde into godotengine:master Feb 7, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@aaronfranke aaronfranke deleted the fix-crash-mesh-root branch February 7, 2024 16:07
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.

3 participants