From be8f5a6db21083cce674c4a0e52a1345a4fcc51a Mon Sep 17 00:00:00 2001 From: Pravdyvy Date: Mon, 27 Apr 2026 15:44:46 +0300 Subject: [PATCH] fix: comments 2 --- indexer_ffi/src/indexer.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/indexer_ffi/src/indexer.rs b/indexer_ffi/src/indexer.rs index a3991388..c110b183 100644 --- a/indexer_ffi/src/indexer.rs +++ b/indexer_ffi/src/indexer.rs @@ -69,13 +69,18 @@ impl IndexerServiceFFI { // Implement Drop to prevent memory leaks impl Drop for IndexerServiceFFI { fn drop(&mut self) { - if self.indexer_handle.is_null() { + let Self { + indexer_handle, + runtime, + } = self; + + if indexer_handle.is_null() { log::error!("Attempted to drop a null indexer pointer. This is a bug"); } - if self.runtime.is_null() { + if runtime.is_null() { log::error!("Attempted to drop a null tokio runtime pointer. This is a bug"); } - drop(unsafe { Box::from_raw(self.indexer_handle.cast::()) }); - drop(unsafe { Box::from_raw(self.runtime.cast::()) }); + drop(unsafe { Box::from_raw(indexer_handle.cast::()) }); + drop(unsafe { Box::from_raw(runtime.cast::()) }); } }