fix: comments 2

This commit is contained in:
Pravdyvy 2026-04-27 15:44:46 +03:00
parent 02949e961a
commit be8f5a6db2

View File

@ -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::<IndexerHandle>()) });
drop(unsafe { Box::from_raw(self.runtime.cast::<Runtime>()) });
drop(unsafe { Box::from_raw(indexer_handle.cast::<IndexerHandle>()) });
drop(unsafe { Box::from_raw(runtime.cast::<Runtime>()) });
}
}