mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:17:35 +00:00
AK: Ensure we never use OwnPtr<> with RefCounted types
This commit is contained in:
parent
62d1ac63e8
commit
0466810638
3 changed files with 15 additions and 1 deletions
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include <AK/Assertions.h>
|
||||
#include <AK/LogStream.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/Traits.h>
|
||||
#include <AK/Types.h>
|
||||
|
@ -51,6 +52,7 @@ public:
|
|||
NonnullOwnPtr(AdoptTag, T& ptr)
|
||||
: m_ptr(&ptr)
|
||||
{
|
||||
static_assert(!is_ref_counted((const T*)nullptr), "Use RefPtr<> for RefCounted types");
|
||||
}
|
||||
NonnullOwnPtr(NonnullOwnPtr&& other)
|
||||
: m_ptr(other.leak_ptr())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue