Skip to content
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

Refactor BaseWidget lifecycle #14455

Open
Tracked by #14456
tsmaeder opened this issue Nov 15, 2024 · 0 comments
Open
Tracked by #14456

Refactor BaseWidget lifecycle #14455

tsmaeder opened this issue Nov 15, 2024 · 0 comments

Comments

@tsmaeder
Copy link
Contributor

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.

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

No branches or pull requests

1 participant