Skip to content

Fix cleanup of cross-object reactive watchers - #6676

Open
happykawayigt wants to merge 1 commit into
Textualize:mainfrom
happykawayigt:fix/remove-cross-object-watchers
Open

Fix cleanup of cross-object reactive watchers#6676
happykawayigt wants to merge 1 commit into
Textualize:mainfrom
happykawayigt:fix/remove-cross-object-watchers

Conversation

@happykawayigt

Copy link
Copy Markdown

Link to issue or discussion

Fixes #6666

Summary

  • track cross-object watcher registrations on the node that owns them
  • unregister those watchers as soon as either the owner or observed node closes
  • add regression coverage for both removal directions

Testing

  • python -m pytest tests/test_reactive.py tests/test_data_bind.py tests/test_widget_removing.py tests/test_unmount.py tests/test_widget.py -q (98 passed)
  • python -m black --check src/textual/reactive.py tests/test_reactive.py
  • git diff --check

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.

Memory leak — watchers from self.watch(other, ...) / data_bind are not removed when the owner is removed from the DOM

1 participant