From eb64a4ca6039733f0c34390d31300d8970a1e9ea Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 11 Jul 2019 16:05:51 +0200 Subject: [PATCH] AK: Remove copy_ref(). This patch removes copy_ref() from RefPtr and NonnullRefPtr. This means that it's now okay to simply copy these smart pointers instead: - RefPtr = RefPtr // Okay! - RefPtr = NonnullRefPtr // Okay! - NonnullRefPtr = NonnullRefPtr // Okay! - NonnullRefPtr = RefPtr // Not okay, since RefPtr can be null. --- AK/NonnullRefPtr.h | 6 ------ AK/RefPtr.h | 5 ----- 2 files changed, 11 deletions(-) diff --git a/AK/NonnullRefPtr.h b/AK/NonnullRefPtr.h index 023444c8e3..53ab7aeccd 100644 --- a/AK/NonnullRefPtr.h +++ b/AK/NonnullRefPtr.h @@ -142,12 +142,6 @@ public: return *this; } - CALLABLE_WHEN(unconsumed) - NonnullRefPtr copy_ref() const - { - return NonnullRefPtr(*m_ptr); - } - CALLABLE_WHEN(unconsumed) SET_TYPESTATE(consumed) T& leak_ref() diff --git a/AK/RefPtr.h b/AK/RefPtr.h index 2bda609789..349fb1de1c 100644 --- a/AK/RefPtr.h +++ b/AK/RefPtr.h @@ -177,11 +177,6 @@ public: return *this; } - RefPtr copy_ref() const - { - return RefPtr(m_ptr); - } - void clear() { deref_if_not_null(m_ptr);