mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Don't compare the vtable pointers anymore when unrooting stuff
This commit is contained in:
parent
05077d31c8
commit
b5aa83f633
2 changed files with 9 additions and 2 deletions
|
@ -262,7 +262,10 @@ impl RootCollection {
|
||||||
unsafe fn unroot(&self, object: *const dyn JSTraceable) {
|
unsafe fn unroot(&self, object: *const dyn JSTraceable) {
|
||||||
debug_assert!(thread_state::get().is_script());
|
debug_assert!(thread_state::get().is_script());
|
||||||
let roots = &mut *self.roots.get();
|
let roots = &mut *self.roots.get();
|
||||||
match roots.iter().rposition(|r| *r == object) {
|
match roots
|
||||||
|
.iter()
|
||||||
|
.rposition(|r| *r as *const () == object as *const ())
|
||||||
|
{
|
||||||
Some(idx) => {
|
Some(idx) => {
|
||||||
roots.remove(idx);
|
roots.remove(idx);
|
||||||
},
|
},
|
||||||
|
|
|
@ -891,7 +891,11 @@ impl RootedTraceableSet {
|
||||||
unsafe fn remove(traceable: *const dyn JSTraceable) {
|
unsafe fn remove(traceable: *const dyn JSTraceable) {
|
||||||
ROOTED_TRACEABLES.with(|ref traceables| {
|
ROOTED_TRACEABLES.with(|ref traceables| {
|
||||||
let mut traceables = traceables.borrow_mut();
|
let mut traceables = traceables.borrow_mut();
|
||||||
let idx = match traceables.set.iter().rposition(|x| *x == traceable) {
|
let idx = match traceables
|
||||||
|
.set
|
||||||
|
.iter()
|
||||||
|
.rposition(|x| *x as *const () == traceable as *const ())
|
||||||
|
{
|
||||||
Some(idx) => idx,
|
Some(idx) => idx,
|
||||||
None => unreachable!(),
|
None => unreachable!(),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue