Skip to content

Commit

Permalink
avm2: Resolve review comments and use activation.gc() in some places
Browse files Browse the repository at this point in the history
  • Loading branch information
Lord-McSweeney authored and Lord-McSweeney committed Aug 1, 2024
1 parent 8f6736d commit c54de07
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 14 deletions.
6 changes: 3 additions & 3 deletions core/src/avm2/object/bytearray_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ impl<'gc> TObject<'gc> for ByteArrayObject<'gc> {
}

unlock!(
Gc::write(activation.context.gc_context, self.0),
Gc::write(activation.gc(), self.0),
ByteArrayObjectData,
base
)
Expand Down Expand Up @@ -192,7 +192,7 @@ impl<'gc> TObject<'gc> for ByteArrayObject<'gc> {
}

unlock!(
Gc::write(activation.context.gc_context, self.0),
Gc::write(activation.gc(), self.0),
ByteArrayObjectData,
base
)
Expand All @@ -215,7 +215,7 @@ impl<'gc> TObject<'gc> for ByteArrayObject<'gc> {
}

Ok(unlock!(
Gc::write(activation.context.gc_context, self.0),
Gc::write(activation.gc(), self.0),
ByteArrayObjectData,
base
)
Expand Down
11 changes: 4 additions & 7 deletions core/src/avm2/object/error_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ pub fn error_allocator<'gc>(

Ok(ErrorObject(Gc::new(
activation.context.gc_context,
ErrorObjectData {
base,
call_stack: RefLock::new(call_stack),
},
ErrorObjectData { base, call_stack },
))
.into())
}
Expand Down Expand Up @@ -58,7 +55,7 @@ pub struct ErrorObjectData<'gc> {
/// Base script object
base: RefLock<ScriptObjectData<'gc>>,

call_stack: RefLock<CallStack<'gc>>,
call_stack: CallStack<'gc>,
}

impl<'gc> ErrorObject<'gc> {
Expand Down Expand Up @@ -107,8 +104,8 @@ impl<'gc> ErrorObject<'gc> {
Ok(output)
}

pub fn call_stack(&self) -> Ref<CallStack<'gc>> {
self.0.call_stack.borrow()
pub fn call_stack(&self) -> &CallStack<'gc> {
&self.0.call_stack
}

fn debug_class_name(&self) -> Box<dyn Debug + 'gc> {
Expand Down
5 changes: 3 additions & 2 deletions core/src/avm2/object/responder_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ impl<'gc> ResponderObject<'gc> {
result: Option<FunctionObject<'gc>>,
status: Option<FunctionObject<'gc>>,
) {
unlock!(Gc::write(mc, self.0), ResponderObjectData, result).set(result);
unlock!(Gc::write(mc, self.0), ResponderObjectData, status).set(status);
let write = Gc::write(mc, self.0);
unlock!(write, ResponderObjectData, result).set(result);
unlock!(write, ResponderObjectData, status).set(status);
}

pub fn send_callback(
Expand Down
4 changes: 2 additions & 2 deletions core/src/avm2/object/xml_list_object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ impl<'gc> XmlListObject<'gc> {
*unlock!(Gc::write(mc, self.0), XmlListObjectData, children).borrow_mut() = children;
}

pub fn target_object(&self) -> Option<XmlOrXmlListObject<'gc>> {
fn target_object(&self) -> Option<XmlOrXmlListObject<'gc>> {
self.0.target_object.get()
}

pub fn target_property(&self) -> Option<Multiname<'gc>> {
fn target_property(&self) -> Option<Multiname<'gc>> {
self.0.target_property.borrow().clone()
}

Expand Down

0 comments on commit c54de07

Please sign in to comment.