Skip to content

Commit c4c1b1d

Browse files
committed
core: Replace RefCell with Cell in FocusTracker
1 parent 383497e commit c4c1b1d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

core/src/focus_tracker.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ use gc_arena::barrier::unlock;
1414
use gc_arena::lock::Lock;
1515
use gc_arena::{Collect, Gc, Mutation};
1616
use ruffle_macros::istr;
17-
use std::cell::RefCell;
17+
use std::cell::Cell;
1818
use std::slice::Iter;
1919
use swf::{Color, Rectangle, Twips};
2020

2121
#[derive(Collect)]
2222
#[collect(no_drop)]
2323
pub struct FocusTrackerData<'gc> {
2424
focus: Lock<Option<InteractiveObject<'gc>>>,
25-
highlight: RefCell<Highlight>,
25+
highlight: Cell<Highlight>,
2626
}
2727

2828
#[derive(Copy, Clone)]
@@ -64,17 +64,17 @@ impl<'gc> FocusTracker<'gc> {
6464
mc,
6565
FocusTrackerData {
6666
focus: Lock::new(None),
67-
highlight: RefCell::new(Highlight::Inactive),
67+
highlight: Cell::new(Highlight::Inactive),
6868
},
6969
))
7070
}
7171

7272
pub fn highlight(&self) -> Highlight {
73-
*self.0.highlight.borrow()
73+
self.0.highlight.get()
7474
}
7575

7676
pub fn reset_highlight(&self) {
77-
self.0.highlight.replace(Highlight::Inactive);
77+
self.0.highlight.set(Highlight::Inactive);
7878
}
7979

8080
pub fn get(&self) -> Option<InteractiveObject<'gc>> {

0 commit comments

Comments
 (0)