mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 23:25:20 +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:
committed by
Tim Flynn
parent
9eb38ce79c
commit
e0713376a0
@@ -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();
|
||||
})))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user