mirror of
https://github.com/Xetibo/ReSet.git
synced 2025-07-01 07:57:44 +02:00
fix: Use splice instead of remove to remove udef behavior
This commit is contained in:
parent
c3fa24ddc8
commit
e0a672935e
3 changed files with 150 additions and 54 deletions
|
@ -470,7 +470,7 @@ pub fn start_input_box_listener(conn: Connection, source_box: Arc<SourceBox>) ->
|
|||
}
|
||||
for entry in 0..*index {
|
||||
if model_list.string(entry) == Some(alias.clone().into()) {
|
||||
model_list.remove(entry);
|
||||
model_list.splice(entry, 1, &[]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -462,21 +462,26 @@ pub fn start_output_box_listener(conn: Connection, sink_box: Arc<SinkBox>) -> Co
|
|||
output_box_imp
|
||||
.reset_sinks
|
||||
.remove(&*entry.clone().unwrap().0);
|
||||
let mut map = output_box_imp.reset_sink_map.write().unwrap();
|
||||
let alias = entry.unwrap().2;
|
||||
map.remove(&alias);
|
||||
let mut index = output_box_imp.reset_model_index.write().unwrap();
|
||||
let model_list = output_box_imp.reset_model_list.write().unwrap();
|
||||
|
||||
// add dummy entry when no other devices are available
|
||||
if *index == 1 {
|
||||
model_list.append("Dummy Output");
|
||||
}
|
||||
|
||||
let mut map = output_box_imp.reset_sink_map.write().unwrap();
|
||||
map.remove(&alias);
|
||||
|
||||
for entry in 0..*index {
|
||||
if model_list.string(entry) == Some(alias.clone().into()) {
|
||||
model_list.remove(entry);
|
||||
model_list.splice(entry, 1, &[]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// dummy enforces a minimum of 1
|
||||
if *index > 1 {
|
||||
*index -= 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue