Summary
SplitContainer.content setter detaches the currently-shown widgets before validating the new value (core/src/toga/widgets/splitcontainer.py):
python @content.setter def content(self, content): for old_content in self._content: if old_content is not None: old_content.app = None old_content.window = None try: if len(content) != 2: raise TypeError() ...
If the assignment is invalid (wrong length, duplicate widget, wrong type), the exception propagates but the old content was already orphaned � its app/window set to None. The widget tree then holds a SplitContainer with no children, while the previously-visible widgets are detached but still referenced externally.
Expected behavior
A failed content assignment should leave the current content attached and untouched.
Actual behavior
Invalid assignment empties the SplitContainer and orphans the previous content (e.g., widgets disappear from app.widgets even though content still reports the old value).
Summary
SplitContainer.contentsetter detaches the currently-shown widgets before validating the new value (core/src/toga/widgets/splitcontainer.py):python @content.setter def content(self, content): for old_content in self._content: if old_content is not None: old_content.app = None old_content.window = None try: if len(content) != 2: raise TypeError() ...If the assignment is invalid (wrong length, duplicate widget, wrong type), the exception propagates but the old content was already orphaned � its
app/windowset toNone. The widget tree then holds a SplitContainer with no children, while the previously-visible widgets are detached but still referenced externally.Expected behavior
A failed
contentassignment should leave the current content attached and untouched.Actual behavior
Invalid assignment empties the SplitContainer and orphans the previous content (e.g., widgets disappear from
app.widgetseven thoughcontentstill reports the old value).