Keep the monitor's whole-extent capture off the record stack

This commit is contained in:
Dennis Kobert
2026-08-24 12:23:32 +00:00
parent dcc9059041
commit d718cdb225
2 changed files with 6 additions and 1 deletions
@@ -205,7 +205,6 @@ impl Fsm for FillToolFsmState {
#[cfg(test)] #[cfg(test)]
mod test_fill { mod test_fill {
pub use crate::test_utils::test_prelude::*; pub use crate::test_utils::test_prelude::*;
use graphene_std::Graphic;
use graphene_std::color::SRGBA8; use graphene_std::color::SRGBA8;
use graphene_std::vector::fill; use graphene_std::vector::fill;
+6
View File
@@ -194,6 +194,9 @@ fn monitor<'e>(
if ctx.innermost_index() == 0 if ctx.innermost_index() == 0
&& let GPoll::Final(value) | GPoll::Partial(value) = &result && let GPoll::Final(value) | GPoll::Partial(value) = &result
{ {
// The materialization below evaluates the level again; its frames sit
// above the one this eval already claimed and must not survive.
let mark = core_types::record::stack::sp();
let captured = match content.layout().depth { let captured = match content.layout().depth {
// SAFETY: the value came from this edge, so it carries the edge's layout. // SAFETY: the value came from this edge, so it carries the edge's layout.
0 => unsafe { RecordCapture::capture(content.layout(), content.layout().rec(value), ctx.arena()) }, 0 => unsafe { RecordCapture::capture(content.layout(), content.layout().rec(value), ctx.arena()) },
@@ -205,6 +208,9 @@ fn monitor<'e>(
LevelStatus::Pending | LevelStatus::Error(_) => None, LevelStatus::Pending | LevelStatus::Error(_) => None,
}, },
}; };
// SAFETY: the capture copies into the arena, so nothing borrows the
// frames left above the mark.
unsafe { core_types::record::stack::rewind(mark) };
*io.lock().unwrap() = captured.map(|output| IORecord { *io.lock().unwrap() = captured.map(|output| IORecord {
input: CtxSnapshot::capture(ctx), input: CtxSnapshot::capture(ctx),
output, output,