fix: stop all will make it address change

This commit is contained in:
Myriad-Dreamin 2025-02-22 19:42:14 +08:00 committed by Myriad-Dreamin
parent 91ba33b274
commit 3db931a1bb

View file

@ -227,8 +227,8 @@ impl PreviewState {
}
pub(crate) fn stop_all(&mut self) {
let watchers = std::mem::take(self.watchers.inner.lock().deref_mut());
for (_, watcher) in watchers {
let mut watchers = self.watchers.inner.lock();
for (_, watcher) in watchers.iter_mut() {
self.preview_tx
.send(PreviewRequest::Kill(
watcher.task_id().to_owned(),
@ -236,6 +236,7 @@ impl PreviewState {
))
.log_error_with(|| format!("failed to send kill request({:?})", watcher.task_id()));
}
watchers.clear();
}
}