Fix geyser plugin unload crash (#34026)

Explicit ordering of the drop of Library and Boxed<dyn GeyserPlugin>: drop the latter explicitly first to avoid crash.
This commit is contained in:
Lijun Wang 2023-11-15 10:11:01 -08:00 committed by GitHub
parent 693d5768c8
commit b5659af546
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -217,9 +217,13 @@ impl GeyserPluginManager {
}
fn _drop_plugin(&mut self, idx: usize) {
let current_lib = self.libs.remove(idx);
let mut current_plugin = self.plugins.remove(idx);
let _current_lib = self.libs.remove(idx);
let name = current_plugin.name().to_string();
current_plugin.on_unload();
drop(current_plugin);
drop(current_lib);
info!("Unloaded plugin {name} at idx {idx}");
}
}