1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:58:12 +00:00

LibGUI+Userland: Make SortingProxyModel::create() return ErrorOr

Unfortunately, most of the users are inside constructors, (and two
others are inside callback lambdas) so the error can't propagate, but
that can be improved later.
This commit is contained in:
Sam Atkins 2021-12-24 12:12:04 +00:00 committed by Brian Gianforcaro
parent c72a996542
commit f6633a1026
11 changed files with 20 additions and 16 deletions

View file

@ -14,7 +14,11 @@ class SortingProxyModel
: public Model
, private ModelClient {
public:
static NonnullRefPtr<SortingProxyModel> create(NonnullRefPtr<Model> source) { return adopt_ref(*new SortingProxyModel(move(source))); }
static ErrorOr<NonnullRefPtr<SortingProxyModel>> create(NonnullRefPtr<Model> source)
{
return adopt_nonnull_ref_or_enomem(new (nothrow) SortingProxyModel(move(source)));
}
virtual ~SortingProxyModel() override;
virtual int row_count(ModelIndex const& = ModelIndex()) const override;