mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-11-02 14:20:58 +00:00
LibWeb: Capture weak this ptr in HTMLTextAreaElement input callback
Fixes GC-leak caused by cycle dependency between input callback and HTMLTextAreaElement that owns it.
This commit is contained in:
parent
9eb38ce79c
commit
e0713376a0
Notes:
sideshowbarker
2024-07-17 03:25:24 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: e0713376a0
Pull-request: https://github.com/SerenityOS/serenity/pull/23605
2 changed files with 7 additions and 3 deletions
|
|
@ -26,7 +26,11 @@ JS_DEFINE_ALLOCATOR(HTMLTextAreaElement);
|
|||
|
||||
HTMLTextAreaElement::HTMLTextAreaElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: HTMLElement(document, move(qualified_name))
|
||||
, m_input_event_timer(Web::Platform::Timer::create_single_shot(0, [this]() { queue_firing_input_event(); }))
|
||||
, m_input_event_timer(MUST(Core::Timer::create_single_shot(0, [weak_this = make_weak_ptr()]() {
|
||||
if (!weak_this)
|
||||
return;
|
||||
static_cast<HTMLTextAreaElement*>(weak_this.ptr())->queue_firing_input_event();
|
||||
})))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue