1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

fix(inspector): Fix panic when re-entering runtime ops (#25537)

Mark `op_require_break_on_next_statement` as reentrant and properly
release borrow on the `OpState`. This fixes `BorrowMut` assertions when
running with inspector + op metrics.

Fixes https://github.com/denoland/deno/issues/25515
This commit is contained in:
Divy Srivastava 2024-09-10 08:14:26 +05:30 committed by GitHub
parent 4af98fa82f
commit c4d088863e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -591,12 +591,14 @@ where
} }
} }
#[op2(fast)] #[op2(fast, reentrant)]
pub fn op_require_break_on_next_statement(state: &mut OpState) { pub fn op_require_break_on_next_statement(state: Rc<RefCell<OpState>>) {
let inspector = state.borrow::<Rc<RefCell<JsRuntimeInspector>>>(); let inspector_rc = {
inspector let state = state.borrow();
.borrow_mut() state.borrow::<Rc<RefCell<JsRuntimeInspector>>>().clone()
.wait_for_session_and_break_on_next_statement() };
let mut inspector = inspector_rc.borrow_mut();
inspector.wait_for_session_and_break_on_next_statement()
} }
fn url_to_file_path_string(url: &Url) -> Result<String, AnyError> { fn url_to_file_path_string(url: &Url) -> Result<String, AnyError> {