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 ValueTrack with Resource is leaking #84942

Merged
merged 1 commit into from
Nov 15, 2023

Conversation

TokageItLab
Copy link
Member

Fixes #84483.

TrackCache must explicitly release references to the resource.

@TokageItLab TokageItLab added this to the 4.2 milestone Nov 15, 2023
@TokageItLab TokageItLab requested a review from a team as a code owner November 15, 2023 16:53
@TokageItLab TokageItLab force-pushed the leak-res-track-cache branch 3 times, most recently from e5e2ae3 to b790b9f Compare November 15, 2023 17:09
scene/animation/animation_mixer.h Outdated Show resolved Hide resolved
@akien-mga akien-mga merged commit 56a2b14 into godotengine:master Nov 15, 2023
15 checks passed
@akien-mga
Copy link
Member

Thanks!


~AnimatedValuesBackup() {
for (KeyValue<NodePath, AnimationMixer::TrackCache *> &K : data) {
memdelete(K.value);
Copy link
Contributor

Choose a reason for hiding this comment

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

You might need a guard here to prevent a crash in a case where the TrackCache * is a nullpointer. Something like

if (K.value) {
    memdelete(K.value);
}

or

ERR_FAIL_NULL(K.value);
memdelete(K.value);

Copy link
Member

Choose a reason for hiding this comment

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

This won't help if the pointer is freed (points to invalid, non-null, memory).

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.

AnimationPlayer texture leaked at exit
4 participants