mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 19:05:06 +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:
parent
a7f4f6afc3
commit
bedad383b5
3 changed files with 28 additions and 12 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue