Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/vision/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
extern crate libc;

use std::mem;
use array::Array;
use defines::{AfError, HomographyType, MatchType};
use util::HasAfEnum;
Expand Down Expand Up @@ -78,8 +79,13 @@ macro_rules! feat_func_def {
unsafe {
let mut temp: i64 = 0;
let err_val = $ffi_name(&mut temp as MutAfArray, self.feat as Feat);

let temp_array = Array::from(temp);
let retained = temp_array.clone();
unsafe { mem::forget(temp_array); }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just changed the implementation based on your suggestion.
Using mem::forget here feels like a bit of a hack, but doing it this way doesn't require touching other files.


match err_val {
0 => Ok(Array::from(temp)),
0 => Ok(retained),
_ => Err(AfError::from(err_val)),
}
}
Expand Down