Many GUI::Widget
subclasses perform fallible actions (such as loading bitmaps, loading GML, or otherwise creating child widgets) inside their constructor. Constructors cannot return ErrorOr
so currently these errors will crash the process instead of being handled gracefully.
Instead, these should be initialized using a factory function that returns ErrorOr
and which propagates all the possible errors using TRY(...)
. For now, this factory function should have the signature ErrorOr<NonnullRefPtr<MyCoolWidget>> MyCoolWidget::try_create()
, as that is what is expected by other code that constructs widgets.
For examples, see Snake, or ThemeEditor which was more involved.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too