Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion adapters/atspi-common/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ impl AppContext {
}

pub(crate) fn push_adapter(&mut self, id: usize, context: &Arc<Context>) {
self.adapters.push((id, Arc::clone(context)));
let index = self.adapter_index(id).unwrap_or_else(|index| index);
self.adapters.insert(index, (id, Arc::clone(context)));
}

pub(crate) fn remove_adapter(&mut self, id: usize) {
Expand Down
21 changes: 13 additions & 8 deletions adapters/unix/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,20 @@ async fn process_adapter_message(
deactivation_handler,
state,
} => {
adapters.push(AdapterEntry {
id,
activation_handler,
deactivation_handler,
state,
});
let index = adapters
.binary_search_by(|entry| entry.id.cmp(&id))
.unwrap_or_else(|index| index);
adapters.insert(
index,
AdapterEntry {
id,
activation_handler,
deactivation_handler,
state,
},
);
if atspi_bus.is_some() {
let entry = adapters.last_mut().unwrap();
activate_adapter(entry);
activate_adapter(&mut adapters[index]);
}
}
Message::RemoveAdapter { id } => {
Expand Down
Loading