fix(plugins): reloading plugin after crash (#2929)
This commit is contained in:
parent
cb46ac0b12
commit
45fea5817e
3 changed files with 9 additions and 2 deletions
|
|
@ -507,6 +507,7 @@ impl<'a> PluginLoader<'a> {
|
||||||
Ok(module)
|
Ok(module)
|
||||||
}
|
}
|
||||||
pub fn compile_module(&mut self) -> Result<Module> {
|
pub fn compile_module(&mut self) -> Result<Module> {
|
||||||
|
self.loading_indication.override_previous_error();
|
||||||
display_loading_stage!(
|
display_loading_stage!(
|
||||||
indicate_loading_plugin_from_hd_cache_notfound,
|
indicate_loading_plugin_from_hd_cache_notfound,
|
||||||
self.loading_indication,
|
self.loading_indication,
|
||||||
|
|
|
||||||
|
|
@ -927,5 +927,4 @@ pub fn handle_plugin_crash(plugin_id: PluginId, message: String, senders: Thread
|
||||||
plugin_id,
|
plugin_id,
|
||||||
loading_indication,
|
loading_indication,
|
||||||
));
|
));
|
||||||
let _ = senders.send_to_plugin(PluginInstruction::Unload(plugin_id));
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ pub struct LoadingIndication {
|
||||||
animation_offset: usize,
|
animation_offset: usize,
|
||||||
plugin_name: String,
|
plugin_name: String,
|
||||||
terminal_emulator_colors: Option<Palette>,
|
terminal_emulator_colors: Option<Palette>,
|
||||||
|
override_previous_error: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LoadingIndication {
|
impl LoadingIndication {
|
||||||
|
|
@ -46,15 +47,18 @@ impl LoadingIndication {
|
||||||
let current_animation_offset = self.animation_offset;
|
let current_animation_offset = self.animation_offset;
|
||||||
let current_terminal_emulator_colors = self.terminal_emulator_colors.take();
|
let current_terminal_emulator_colors = self.terminal_emulator_colors.take();
|
||||||
let mut current_error = self.error.take();
|
let mut current_error = self.error.take();
|
||||||
|
let override_previous_error = other.override_previous_error;
|
||||||
drop(std::mem::replace(self, other));
|
drop(std::mem::replace(self, other));
|
||||||
self.animation_offset = current_animation_offset;
|
self.animation_offset = current_animation_offset;
|
||||||
self.terminal_emulator_colors = current_terminal_emulator_colors;
|
self.terminal_emulator_colors = current_terminal_emulator_colors;
|
||||||
if let Some(current_error) = current_error.take() {
|
if let Some(current_error) = current_error.take() {
|
||||||
// we do this so that only the first error (usually the root cause) will be shown
|
// we do this so that only the first error (usually the root cause) will be shown
|
||||||
// when plugins support scrolling, we might want to do an append here
|
// when plugins support scrolling, we might want to do an append here
|
||||||
|
if !override_previous_error {
|
||||||
self.error = Some(current_error);
|
self.error = Some(current_error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
pub fn indicate_loading_plugin_from_memory(&mut self) {
|
pub fn indicate_loading_plugin_from_memory(&mut self) {
|
||||||
self.loading_from_memory = Some(LoadingStatus::InProgress);
|
self.loading_from_memory = Some(LoadingStatus::InProgress);
|
||||||
}
|
}
|
||||||
|
|
@ -113,6 +117,9 @@ impl LoadingIndication {
|
||||||
pub fn is_error(&self) -> bool {
|
pub fn is_error(&self) -> bool {
|
||||||
self.error.is_some()
|
self.error.is_some()
|
||||||
}
|
}
|
||||||
|
pub fn override_previous_error(&mut self) {
|
||||||
|
self.override_previous_error = true;
|
||||||
|
}
|
||||||
fn started_loading(&self) -> bool {
|
fn started_loading(&self) -> bool {
|
||||||
self.loading_from_memory.is_some()
|
self.loading_from_memory.is_some()
|
||||||
|| self.loading_from_hd_cache.is_some()
|
|| self.loading_from_hd_cache.is_some()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue