Move debug_elements
to AsyncAppContext
Previously, `debug_elements` was available on `WindowContext`. If that method was called while having a borrow out to a view, it would panic because the view would already have been borrowed. By moving it to an `AsyncAppContext` we ensure the method can't be called while a view is being used.
This commit is contained in:
parent
4c1cba6def
commit
794446bf8b
4 changed files with 23 additions and 20 deletions
|
@ -708,7 +708,12 @@ impl<V: View> AnyRootElement for RootElement<V> {
|
|||
.ok_or_else(|| anyhow!("debug called on a root element for a dropped view"))?;
|
||||
let view = view.read(cx);
|
||||
let view_context = ViewContext::immutable(cx, self.view.id());
|
||||
Ok(self.element.debug(view, &view_context))
|
||||
Ok(serde_json::json!({
|
||||
"view_id": self.view.id(),
|
||||
"view_name": V::ui_name(),
|
||||
"view": view.debug_json(cx),
|
||||
"element": self.element.debug(view, &view_context)
|
||||
}))
|
||||
}
|
||||
|
||||
fn name(&self) -> Option<&str> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue