Skip to content

Fix Scratch event flows disposal handling#337

Merged
oco777 merged 1 commit intomainfrom
codex/fix-double-disposal-of-flow-in-eventunits
Nov 17, 2025
Merged

Fix Scratch event flows disposal handling#337
oco777 merged 1 commit intomainfrom
codex/fix-double-disposal-of-flow-in-eventunits

Conversation

@oco777
Copy link
Copy Markdown
Owner

@oco777 oco777 commented Nov 17, 2025

Summary

  • stop disposing Visual Scripting Flow instances in Scratch event units and let Flow.Coroutine manage lifecycle
  • update VS_Scratch_Mapping documentation to describe the new Flow handling approach

Testing

  • not run (not requested)

Codex Task

@oco777 oco777 merged commit db8b006 into main Nov 17, 2025
3 checks passed
@oco777 oco777 deleted the codex/fix-double-disposal-of-flow-in-eventunits branch November 17, 2025 14:14
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

private IEnumerator RunEventCoroutine(Flow flow, EmptyEventArgs args)
{
if (!ShouldTrigger(flow, args))
{
yield break;
}

P1 Badge Dispose Flow when key event does not trigger

RunEventCoroutine now returns immediately when ShouldTrigger is false, but the Flow allocated in TriggerWithThreadRegistration is no longer wrapped in a using or passed to Flow.StartCoroutine. Because this unit listens to EventHooks.Update, the monitored key will be unpressed most frames, so every frame allocates a Flow that is never disposed, steadily leaking memory/GC pressure during normal play. The prior using (flow) cleaned up these skipped events; some disposal is still needed for the non-trigger path.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant