mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-24 00:24:38 +00:00
Shell: Store LocalFrames as NonnullOwnPtr<LocalFrame> instead
As Vector<T> will relocate objects to resize, we cannot assume that the address of a specific LocalFrame will stay constant, or that the reference will not be dangling to begin with. Fixes an assertion that fires when a frame push causes the Vector to reallocate.
This commit is contained in:
committed by
Andreas Kling
parent
a7f4f6afc3
commit
bedad383b5
@@ -1033,7 +1033,7 @@ RefPtr<Value> ForLoop::run(RefPtr<Shell> shell)
|
||||
RefPtr<Value> block_value;
|
||||
|
||||
{
|
||||
auto frame = shell->push_frame();
|
||||
auto frame = shell->push_frame(String::formatted("for ({})", this));
|
||||
shell->set_local_variable(m_variable_name, value);
|
||||
|
||||
block_value = m_block->run(shell);
|
||||
@@ -1585,7 +1585,7 @@ RefPtr<Value> MatchExpr::run(RefPtr<Shell> shell)
|
||||
return pattern;
|
||||
};
|
||||
|
||||
auto frame = shell->push_frame();
|
||||
auto frame = shell->push_frame(String::formatted("match ({})", this));
|
||||
if (!m_expr_name.is_empty())
|
||||
shell->set_local_variable(m_expr_name, value);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user