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 SkyRD::Sky::free() freeing shared material #96486

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

ComycSans
Copy link
Contributor

Fixes #95645

When a scene that has a WorldEnvironment that contains a Sky resource gets closed, SkyRD::Sky::free() gets called, which currently frees the material used by that Sky. This is a problem when multiple Skies use the same material.
This PR aims to fix that by removing the instruction which frees the material, since it already gets freed when Sky gets unreferenced.

@ComycSans ComycSans requested a review from a team as a code owner September 2, 2024 17:33
Copy link
Member

@clayjohn clayjohn left a comment

Choose a reason for hiding this comment

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

Looks good. It is very strange that we ever freed the material here.

@clayjohn clayjohn added this to the 4.4 milestone Sep 2, 2024
@clayjohn clayjohn added the cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release label Sep 2, 2024
@akien-mga akien-mga merged commit d1c27f2 into godotengine:master Sep 3, 2024
19 checks passed
@akien-mga
Copy link
Member

Thanks! And congrats for your first merged Godot contribution 🎉

@akien-mga
Copy link
Member

Cherry-picked for 4.3.1.

@akien-mga akien-mga removed the cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release label Sep 16, 2024
@ComycSans ComycSans deleted the black_sky branch October 2, 2024 18:42
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.

Sky goes black after closing a scene and switching to another that uses the same sky material
3 participants