mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-10 11:36:22 +00:00
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:
parent
4abdb68655
commit
d5ed07fdc4
Notes:
sideshowbarker
2024-07-17 06:40:21 +09:00
Author: https://github.com/awesomekling
Commit: d5ed07fdc4
Pull-request: https://github.com/SerenityOS/serenity/pull/16489
Reviewed-by: https://github.com/linusg ✅
5 changed files with 32 additions and 39 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue