fix: prevent GTK widget-tree corruption when navigating back to a page with HA buttons#24
fix: prevent GTK widget-tree corruption when navigating back to a page with HA buttons#24Copilot wants to merge 3 commits into
Conversation
Agent-Logs-Url: https://github.com/gensyn/HomeAssistantPlugin/sessions/d5a320b9-d9b8-4bd3-81c7-69a212a7a872 Co-authored-by: gensyn <36128035+gensyn@users.noreply.github.com>
Agent-Logs-Url: https://github.com/gensyn/HomeAssistantPlugin/sessions/d5a320b9-d9b8-4bd3-81c7-69a212a7a872 Co-authored-by: gensyn <36128035+gensyn@users.noreply.github.com>
|
@copilot Please fix the failing tests. |
… bypass Agent-Logs-Url: https://github.com/gensyn/HomeAssistantPlugin/sessions/8832f1bc-a005-4429-a702-289d489821e7 Co-authored-by: gensyn <36128035+gensyn@users.noreply.github.com>
Fixed in d5025e8. The |
There was a problem hiding this comment.
Pull request overview
Fixes a GTK crash caused by widget-tree corruption when navigating back to actions that use Home Assistant customizations, by preventing _load_customizations() from mutating the expander while the action is being removed/detached.
Changes:
- Add a
_clearingflag toCustomizationCoreand guard_load_customizations()to no-op while clearing. - Override
CustomizationCore.on_remove()to set_clearingduringsuper().on_remove(), then clear the expander rows and reset the flag. - Add/adjust unit tests to validate the new
on_remove()behavior and ensure_clearingis initialized in__new__-constructed instances.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| actions/cores/customization_core/customization_core.py | Introduces _clearing, guards _load_customizations(), and adds a safe on_remove() cleanup sequence to avoid GTK widget-tree corruption. |
| test/actions/cores/customization_core/test_customization_core.py | Adds unit tests for skipping loads during clearing and for on_remove() flag/cleanup behavior; fixes an existing test setup to initialize _clearing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
_clearingflag toCustomizationCoreto block_load_customizations()duringon_remove()on_remove()inCustomizationCoreto set the flag, callsuper().on_remove(), clear the expander, then reset the flag_load_customizations()with the flaginstance._clearing = Falsetotest_load_customizations(instance was created via__new__, bypassing__init__)