Skip to content

story: Avoid retaining PopoverStory from popover child#2378

Merged
huacnlee merged 1 commit into
longbridge:mainfrom
HuaGu-Dragon:fix_story
May 17, 2026
Merged

story: Avoid retaining PopoverStory from popover child#2378
huacnlee merged 1 commit into
longbridge:mainfrom
HuaGu-Dragon:fix_story

Conversation

@HuaGu-Dragon
Copy link
Copy Markdown
Contributor

@HuaGu-Dragon HuaGu-Dragon commented May 17, 2026

Summary

While reading the story examples to learn how to use, I noticed a potential memory leak in the popover story.

Form and DropdownListDelegate were holding a strong Entity<PopoverStory> reference back to their parent. Since these child entities are owned by PopoverStory, keeping a strong parent reference can create a retain cycle.

This PR changes those parent references to WeakEntity<PopoverStory> and safely ignores updates when the parent has already been dropped.

Changes

  • Replace strong Entity<PopoverStory> parent references with WeakEntity<PopoverStory>.
  • Use cx.weak_entity() when passing the parent into Form and DropdownListDelegate.
  • Handle WeakEntity::update results without assuming the parent still exists.

Notes

Thanks for providing such a great component set. I found this while studying the story examples and wanted to fix a small lifecycle issue that could otherwise be easy to miss.

@huacnlee huacnlee changed the title fix(story): avoid retaining PopoverStory from popover child story: Avoid retaining PopoverStory from popover child May 17, 2026
@huacnlee huacnlee merged commit a5268cd into longbridge:main May 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants