Use a read lock in clone_into_external_dom (#64)

This commit is contained in:
Kenneth Loeffler 2023-07-09 23:11:26 -07:00 committed by GitHub
parent 63e2b926e6
commit b0861ce0fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -141,8 +141,8 @@ impl Instance {
*/ */
pub fn clone_into_external_dom(self, external_dom: &mut WeakDom) -> DomRef { pub fn clone_into_external_dom(self, external_dom: &mut WeakDom) -> DomRef {
let dom = INTERNAL_DOM let dom = INTERNAL_DOM
.try_write() .try_read()
.expect("Failed to get write access to document"); .expect("Failed to get read access to document");
let cloned = dom.clone_into_external(self.dom_ref, external_dom); let cloned = dom.clone_into_external(self.dom_ref, external_dom);
external_dom.transfer_within(cloned, external_dom.root_ref()); external_dom.transfer_within(cloned, external_dom.root_ref());