diff --git a/cli/ops/plugin.rs b/cli/ops/plugin.rs index f7c4c667c6c5f0..d329d62d90fb18 100644 --- a/cli/ops/plugin.rs +++ b/cli/ops/plugin.rs @@ -109,6 +109,10 @@ impl<'a> plugin_api::Interface for PluginInterface<'a> { self.isolate_state.op_registry.register( name, move |isolate_state, zero_copy| { + // This is a hack that ensures that dispatch_op_fn is dropped first to + // prevent segfaults. + dispatch_op_fn; + plugin_lib; let mut interface = PluginInterface::new(isolate_state, &plugin_lib); let op = dispatch_op_fn(&mut interface, zero_copy); match op { diff --git a/core/core_isolate.rs b/core/core_isolate.rs index 98345cd251b90d..a60ce6a82d1908 100644 --- a/core/core_isolate.rs +++ b/core/core_isolate.rs @@ -147,15 +147,6 @@ impl DerefMut for CoreIsolate { } } -impl Drop for CoreIsolateState { - fn drop(&mut self) { - // TODO(afinch7) this is a temporary fix for a segfault that occurus when - // dropping plugin ops. I know that the plugin Rc value gets dropped - // early for some reason, but still not quite sure why. - drop(std::mem::take(&mut self.op_registry)); - } -} - impl Drop for CoreIsolate { fn drop(&mut self) { if let Some(creator) = self.snapshot_creator.take() {