LibJS+LibWeb: Remove NonnullGCPtr<T>::operator=(GCPtr<T>) footgun

GCPtr can be null so it's not safe to assign it to a NonnullGCPtr unless
you know it to be non-null.

This exposed a number of wrong uses in LibWeb which had to be fixed as
part of this change.
This commit is contained in:
Andreas Kling 2022-12-14 13:43:57 +01:00
commit d5ed07fdc4
Notes: sideshowbarker 2024-07-17 06:40:21 +09:00
5 changed files with 32 additions and 39 deletions

View file

@ -49,13 +49,6 @@ public:
{
}
NonnullGCPtr& operator=(GCPtr<T> const& other)
{
m_ptr = const_cast<T*>(other.ptr());
VERIFY(m_ptr);
return *this;
}
NonnullGCPtr& operator=(T const& other)
{
m_ptr = &const_cast<T&>(other);