mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-13 04:52:23 +00:00
LibCore: Remove unnecessary or invalid write after child remove
This commit is contained in:
parent
561e011e07
commit
e1598233e1
Notes:
sideshowbarker
2024-07-17 05:03:11 +09:00
Author: https://github.com/MINAqwq 🔰
Commit: e1598233e1
Pull-request: https://github.com/SerenityOS/serenity/pull/23463
Reviewed-by: https://github.com/trflynn89 ✅
1 changed files with 3 additions and 1 deletions
|
@ -134,7 +134,9 @@ public:
|
||||||
{
|
{
|
||||||
if (m_parent)
|
if (m_parent)
|
||||||
m_parent->remove_child(*this);
|
m_parent->remove_child(*this);
|
||||||
m_parent = nullptr;
|
|
||||||
|
// The call to `remove_child` may have deleted the object.
|
||||||
|
// Do not dereference `this` from this point forward.
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, class... Args>
|
template<class T, class... Args>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue