avm2: Resolve review comments and use `activation.gc()` in some places

This commit is contained in:
Lord-McSweeney 2024-07-31 15:58:31 -07:00 committed by Lord-McSweeney
parent 8f6736da74
commit c54de07382
4 changed files with 12 additions and 14 deletions

View File

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

View File

@ -27,10 +27,7 @@ pub fn error_allocator<'gc>(
Ok(ErrorObject(Gc::new( Ok(ErrorObject(Gc::new(
activation.context.gc_context, activation.context.gc_context,
ErrorObjectData { ErrorObjectData { base, call_stack },
base,
call_stack: RefLock::new(call_stack),
},
)) ))
.into()) .into())
} }
@ -58,7 +55,7 @@ pub struct ErrorObjectData<'gc> {
/// Base script object /// Base script object
base: RefLock<ScriptObjectData<'gc>>, base: RefLock<ScriptObjectData<'gc>>,
call_stack: RefLock<CallStack<'gc>>, call_stack: CallStack<'gc>,
} }
impl<'gc> ErrorObject<'gc> { impl<'gc> ErrorObject<'gc> {
@ -107,8 +104,8 @@ impl<'gc> ErrorObject<'gc> {
Ok(output) Ok(output)
} }
pub fn call_stack(&self) -> Ref<CallStack<'gc>> { pub fn call_stack(&self) -> &CallStack<'gc> {
self.0.call_stack.borrow() &self.0.call_stack
} }
fn debug_class_name(&self) -> Box<dyn Debug + 'gc> { fn debug_class_name(&self) -> Box<dyn Debug + 'gc> {

View File

@ -76,8 +76,9 @@ impl<'gc> ResponderObject<'gc> {
result: Option<FunctionObject<'gc>>, result: Option<FunctionObject<'gc>>,
status: Option<FunctionObject<'gc>>, status: Option<FunctionObject<'gc>>,
) { ) {
unlock!(Gc::write(mc, self.0), ResponderObjectData, result).set(result); let write = Gc::write(mc, self.0);
unlock!(Gc::write(mc, self.0), ResponderObjectData, status).set(status); unlock!(write, ResponderObjectData, result).set(result);
unlock!(write, ResponderObjectData, status).set(status);
} }
pub fn send_callback( pub fn send_callback(

View File

@ -121,11 +121,11 @@ impl<'gc> XmlListObject<'gc> {
*unlock!(Gc::write(mc, self.0), XmlListObjectData, children).borrow_mut() = children; *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() 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() self.0.target_property.borrow().clone()
} }