debugger: Fix restarting terminated child sessions (#29173)
This fixes a bug where terminated child session failed to restart because they were using the wrong configuration/binary to start a new session Release Notes: - N/A
This commit is contained in:
parent
0f3ac38332
commit
e8fe0eb2e6
2 changed files with 36 additions and 40 deletions
|
@ -902,15 +902,6 @@ fn create_new_session(
|
|||
this.shutdown_session(session_id, cx).detach_and_log_err(cx);
|
||||
}
|
||||
SessionStateEvent::Restart => {
|
||||
let Some((config, binary)) = session.read_with(cx, |session, _| {
|
||||
session
|
||||
.configuration()
|
||||
.map(|config| (config, session.binary().clone()))
|
||||
}) else {
|
||||
log::error!("Failed to get debug config from session");
|
||||
return;
|
||||
};
|
||||
|
||||
let mut curr_session = session;
|
||||
while let Some(parent_id) = curr_session.read(cx).parent_id() {
|
||||
if let Some(parent_session) = this.sessions.get(&parent_id).cloned() {
|
||||
|
@ -921,6 +912,15 @@ fn create_new_session(
|
|||
}
|
||||
}
|
||||
|
||||
let Some((config, binary)) = curr_session.read_with(cx, |session, _| {
|
||||
session
|
||||
.configuration()
|
||||
.map(|config| (config, session.root_binary().clone()))
|
||||
}) else {
|
||||
log::error!("Failed to get debug config from session");
|
||||
return;
|
||||
};
|
||||
|
||||
let session_id = curr_session.read(cx).session_id();
|
||||
|
||||
let task = curr_session.update(cx, |session, cx| session.shutdown(cx));
|
||||
|
@ -931,7 +931,13 @@ fn create_new_session(
|
|||
|
||||
this.update(cx, |this, cx| {
|
||||
this.sessions.remove(&session_id);
|
||||
this.new_session(binary, config, worktree, None, cx)
|
||||
this.new_session(
|
||||
binary.as_ref().clone(),
|
||||
config,
|
||||
worktree,
|
||||
None,
|
||||
cx,
|
||||
)
|
||||
})?
|
||||
.1
|
||||
.await?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue