summaryrefslogtreecommitdiff
path: root/Kernel/Library/ThreadSafeWeakPtr.h
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2022-02-13 21:21:14 +0200
committerAndreas Kling <kling@serenityos.org>2022-02-13 23:02:57 +0100
commitc8ab7bde3b9a75ec8b6706eda87daebc66624154 (patch)
treec4144cd0731dde8a37979378340360eb9d43f7c9 /Kernel/Library/ThreadSafeWeakPtr.h
parent98c20b65cc1e436e805f066bf2b007ebf0a798ec (diff)
downloadserenity-c8ab7bde3b9a75ec8b6706eda87daebc66624154.zip
Kernel: Use try_make_weak_ptr() instead of make_weak_ptr()
Diffstat (limited to 'Kernel/Library/ThreadSafeWeakPtr.h')
-rw-r--r--Kernel/Library/ThreadSafeWeakPtr.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/Kernel/Library/ThreadSafeWeakPtr.h b/Kernel/Library/ThreadSafeWeakPtr.h
index 5768f9b0a8..ad11e082bb 100644
--- a/Kernel/Library/ThreadSafeWeakPtr.h
+++ b/Kernel/Library/ThreadSafeWeakPtr.h
@@ -53,7 +53,7 @@ public:
template<typename U, typename EnableIf<IsBaseOf<T, U>>::Type* = nullptr>
WeakPtr(const U& object)
- : m_link(object.template make_weak_ptr<U>().take_link())
+ : m_link(object.template try_make_weak_ptr<U>().release_value_but_fixme_should_propagate_errors().take_link())
{
}
@@ -61,7 +61,7 @@ public:
WeakPtr(const U* object)
{
if (object)
- m_link = object->template make_weak_ptr<U>().take_link();
+ m_link = object->template try_make_weak_ptr<U>().release_value_but_fixme_should_propagate_errors().take_link();
}
template<typename U, typename EnableIf<IsBaseOf<T, U>>::Type* = nullptr>
@@ -69,7 +69,7 @@ public:
{
object.do_while_locked([&](U* obj) {
if (obj)
- m_link = obj->template make_weak_ptr<U>().take_link();
+ m_link = obj->template try_make_weak_ptr<U>().release_value_but_fixme_should_propagate_errors().take_link();
});
}
@@ -78,14 +78,14 @@ public:
{
object.do_while_locked([&](U* obj) {
if (obj)
- m_link = obj->template make_weak_ptr<U>().take_link();
+ m_link = obj->template try_make_weak_ptr<U>().release_value_but_fixme_should_propagate_errors().take_link();
});
}
template<typename U, typename EnableIf<IsBaseOf<T, U>>::Type* = nullptr>
WeakPtr& operator=(const U& object)
{
- m_link = object.template make_weak_ptr<U>().take_link();
+ m_link = object.template try_make_weak_ptr<U>().release_value_but_fixme_should_propagate_errors().take_link();
return *this;
}
@@ -93,7 +93,7 @@ public:
WeakPtr& operator=(const U* object)
{
if (object)
- m_link = object->template make_weak_ptr<U>().take_link();
+ m_link = object->template try_make_weak_ptr<U>().release_value_but_fixme_should_propagate_errors().take_link();
else
m_link = nullptr;
return *this;
@@ -104,7 +104,7 @@ public:
{
object.do_while_locked([&](U* obj) {
if (obj)
- m_link = obj->template make_weak_ptr<U>().take_link();
+ m_link = obj->template try_make_weak_ptr<U>().release_value_but_fixme_should_propagate_errors().take_link();
else
m_link = nullptr;
});
@@ -116,7 +116,7 @@ public:
{
object.do_while_locked([&](U* obj) {
if (obj)
- m_link = obj->template make_weak_ptr<U>().take_link();
+ m_link = obj->template try_make_weak_ptr<U>().release_value_but_fixme_should_propagate_errors().take_link();
else
m_link = nullptr;
});