diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-01-30 16:06:52 -0700 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-01-30 16:06:52 -0700 |
commit | a7e29939a1df679bd865573dc71f7ba65f0268c4 (patch) | |
tree | a7ef2fbaeb96519cb7649dc0b70dd7b385d49b30 /components/script/dom/bindings | |
parent | 172aed535be3c34775824dac64ad2b91fc379ad5 (diff) | |
parent | 7b9c902a0af52b0b25787e09242b70a278ba55d2 (diff) | |
download | servo-a7e29939a1df679bd865573dc71f7ba65f0268c4.tar.gz servo-a7e29939a1df679bd865573dc71f7ba65f0268c4.zip |
auto merge of #4777 : dmarcos/servo/issue4692, r=jdm
...id 'DOMRefCell already mutably borrowed' messages. This is just a temporary fix until the Rust standard library allows borrowing already-borrowed RefCell values during unwinding.
It also removes LiveDOMReferences destructor that it's a no-op but it contains an assert that was being violated causing an endless cycle of destructor calls ending up in a stack overflow.
Diffstat (limited to 'components/script/dom/bindings')
-rw-r--r-- | components/script/dom/bindings/cell.rs | 7 | ||||
-rw-r--r-- | components/script/dom/bindings/refcounted.rs | 6 |
2 files changed, 7 insertions, 6 deletions
diff --git a/components/script/dom/bindings/cell.rs b/components/script/dom/bindings/cell.rs index 41ebf76f426..fc0a845b748 100644 --- a/components/script/dom/bindings/cell.rs +++ b/components/script/dom/bindings/cell.rs @@ -41,6 +41,13 @@ impl<T> DOMRefCell<T> { &*self.value.as_unsafe_cell().get() } + /// Borrow the contents for the purpose of script deallocation. + /// + pub unsafe fn borrow_for_script_deallocation<'a>(&'a self) -> &'a mut T { + debug_assert!(task_state::get().contains(SCRIPT)); + &mut *self.value.as_unsafe_cell().get() + } + /// Is the cell mutably borrowed? /// /// For safety checks in debug builds only. diff --git a/components/script/dom/bindings/refcounted.rs b/components/script/dom/bindings/refcounted.rs index 742f187e061..35a87411fd9 100644 --- a/components/script/dom/bindings/refcounted.rs +++ b/components/script/dom/bindings/refcounted.rs @@ -188,9 +188,3 @@ impl LiveDOMReferences { }) } } - -impl Drop for LiveDOMReferences { - fn drop(&mut self) { - assert!(self.table.borrow().keys().count() == 0); - } -} |