fix: also remove sources from panel when deleted

This commit is contained in:
əlemi 2022-06-18 19:36:41 +02:00
parent b05f8005e7
commit c5af43f6ca
No known key found for this signature in database
GPG key ID: BBCBFE5D7244634E

View file

@ -230,6 +230,11 @@ impl eframe::App for App {
if let Err(e) = self.data.storage.lock().expect("Storage Mutex poisoned").delete_panel(panels[i].id) { if let Err(e) = self.data.storage.lock().expect("Storage Mutex poisoned").delete_panel(panels[i].id) {
error!(target: "ui", "Could not delete panel : {:?}", e); error!(target: "ui", "Could not delete panel : {:?}", e);
} else { } else {
for source in self.data.sources.write().expect("Sources RwLock poisoned").iter_mut() {
if source.panel_id == panels[i].id {
source.panel_id = -1;
}
}
panels.remove(i); panels.remove(i);
} }
} else if let Some(i) = to_swap { } else if let Some(i) = to_swap {