Skip to content

Refactor BaseWidget lifecycle #14455

Open
@tsmaeder

Description

Feature Description:

In BaseWidget.onCloseRequested() we invoke the dispose() method in the widget. I believe this is wrong, due to the argument in #12093 (comment):

when a client invokes ApplicationShell.addWidget(), it can pass widgets which are not derived from BaseWidget. When we later call ApplicationShell.closeWidget() on that widget, we should invoke dispose() on the widget after calling close() on it, since we do not know that close() invokes dispose(). Currently, any widget that does not dispose itself upon close() will go undisposed and might leak resources. However, calling dispose() on a BaseWidget after it is close will double-dispose and throw an error.

The clients managing the widget lifecycle should be reponsible for disposing of the widgets, not the widget itself.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions