-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Widget life-cycle model - bug - Stack calls size_rules without set_rect on inactive children #486
Comments
The more general problems here are: The widget life-cycle is underspecified
Poor enforcement of widget life-cycleThe
|
#485 has been updated to fix the observable bug and to clarify that Event handling code was checked to look for any assumptions that some event such as |
A bug is observable in #485. Example output from
examples/gallery.rs
in debug mode (widget varies but is usually aScrollBar
under aScrollLabel
, i.e. an auto-hidingScrollBar
):The cause does not appear to be new:
<Stack as Layout>::size_rules
may callsize_rules
on in-active children<Stack as Layout>::set_rect
only callsset_rect
on the active childEvents::handle_event
on a child which has not hadset_rect
called (since the last call tosize_rules
)This violates the widget state model:
set_rect
should be called aftersize_rules
before most other methods such asevent_handler
. Some possible solutions:set_rect
aftersize_rules
if formerly called. This is an incomplete fix since in theory nothing prevents delivery of events to aStack
page which has not yet been made active (and thus never hadset_rect
called).Stack
more fully track the state of children and avoid delivering events to children which are not active. This opens another potential issue: a former child will not receive events such asEvent::lost_nav_focus
which could in theory cause issues in widget code; this may be fixable by re-configuring a child each time it is made active but (a) this is otherwise unnecessary work and (b) this is an under-specified part of the widget model (thoughListView
does exactly this when re-assigning its child widgets to a new data entry).Stack
could avoid queryingsize_rules
on inactive children. Undesirable.Stack
could callset_rect
on each child it calledsize_rules
on. This seems unnecessary.The text was updated successfully, but these errors were encountered: