mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:47:35 +00:00
AK+Kernel: Add an OOM-fallible try variant make_weak_ptr()
This will allow us to propagate allocation errors that may be raised by the construction of the WeakLink.
This commit is contained in:
parent
d6ea6c39a7
commit
98c20b65cc
3 changed files with 28 additions and 14 deletions
|
@ -106,7 +106,9 @@ private:
|
|||
|
||||
public:
|
||||
template<typename U = T>
|
||||
WeakPtr<U> make_weak_ptr() const;
|
||||
WeakPtr<U> make_weak_ptr() const { return MUST(try_make_weak_ptr<U>()); }
|
||||
template<typename U = T>
|
||||
ErrorOr<WeakPtr<U>> try_make_weak_ptr() const;
|
||||
|
||||
protected:
|
||||
Weakable() = default;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue