summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2022-02-13 21:34:11 +0200
committerAndreas Kling <kling@serenityos.org>2022-02-13 23:02:57 +0100
commitb32cf33a23064394fc0bd694262fee523cd98b58 (patch)
treef08c81a6819a352b34b86c99ebd3b9e4b4a5c5c5
parentc8ab7bde3b9a75ec8b6706eda87daebc66624154 (diff)
downloadserenity-b32cf33a23064394fc0bd694262fee523cd98b58.zip
Kernel: Remove make_weak_ptr()
New users of WeakPtr in the kernel should use try_make_weak_ptr instead
-rw-r--r--AK/Weakable.h7
-rw-r--r--Kernel/Library/ThreadSafeWeakPtr.h6
2 files changed, 6 insertions, 7 deletions
diff --git a/AK/Weakable.h b/AK/Weakable.h
index c800be9205..0aad3cb436 100644
--- a/AK/Weakable.h
+++ b/AK/Weakable.h
@@ -105,8 +105,13 @@ private:
class Link;
public:
+#ifndef KERNEL
template<typename U = T>
- WeakPtr<U> make_weak_ptr() const { return MUST(try_make_weak_ptr<U>()); }
+ WeakPtr<U> make_weak_ptr() const
+ {
+ return MUST(try_make_weak_ptr<U>());
+ }
+#endif
template<typename U = T>
ErrorOr<WeakPtr<U>> try_make_weak_ptr() const;
diff --git a/Kernel/Library/ThreadSafeWeakPtr.h b/Kernel/Library/ThreadSafeWeakPtr.h
index ad11e082bb..46e0b44d28 100644
--- a/Kernel/Library/ThreadSafeWeakPtr.h
+++ b/Kernel/Library/ThreadSafeWeakPtr.h
@@ -237,12 +237,6 @@ ErrorOr<WeakPtr<T>> try_make_weak_ptr_if_nonnull(T const* ptr)
return WeakPtr<T> {};
}
-template<typename T>
-WeakPtr<T> make_weak_ptr_if_nonnull(T const* ptr)
-{
- return MUST(try_make_weak_ptr_if_nonnull(ptr));
-}
-
}
using AK::WeakPtr;