mirror of
https://github.com/zed-industries/zed.git
synced 2024-10-23 14:59:50 +00:00
Fix a circular reference between Client and UserStore
Before this change once the UserStore had been created, the Client would never be dropped.
This commit is contained in:
parent
0b1b758f02
commit
34efb23bf6
1 changed files with 6 additions and 0 deletions
|
@ -146,7 +146,13 @@ impl UserStore {
|
||||||
}),
|
}),
|
||||||
_maintain_current_user: cx.spawn(|this, mut cx| async move {
|
_maintain_current_user: cx.spawn(|this, mut cx| async move {
|
||||||
let mut status = client.status();
|
let mut status = client.status();
|
||||||
|
let weak = Arc::downgrade(&client);
|
||||||
|
drop(client);
|
||||||
while let Some(status) = status.next().await {
|
while let Some(status) = status.next().await {
|
||||||
|
// if the client is dropped, the app is shutting down.
|
||||||
|
let Some(client) = weak.upgrade() else {
|
||||||
|
return Ok(());
|
||||||
|
};
|
||||||
match status {
|
match status {
|
||||||
Status::Connected { .. } => {
|
Status::Connected { .. } => {
|
||||||
if let Some(user_id) = client.user_id() {
|
if let Some(user_id) = client.user_id() {
|
||||||
|
|
Loading…
Reference in a new issue