File tree Expand file tree Collapse file tree 2 files changed +8
-11
lines changed Expand file tree Collapse file tree 2 files changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -313,6 +313,8 @@ afCall1' op =
313313 throwAFError =<< op ptrInput
314314 peek ptrInput
315315
316+ -- | Note: We don't add a finalizer to 'Array' since the 'Features' finalizer frees 'Array'
317+ -- under the hood.
316318featuresToArray
317319 :: Features
318320 -> (Ptr AFArray -> AFFeatures -> IO AFErr )
@@ -324,8 +326,7 @@ featuresToArray (Features fptr1) op =
324326 alloca $ \ ptrInput -> do
325327 throwAFError =<< op ptrInput ptr1
326328 Array <$> do
327- newForeignPtr af_release_array_finalizer
328- =<< peek ptrInput
329+ newForeignPtr_ =<< peek ptrInput
329330
330331infoFromFeatures
331332 :: Storable a
@@ -439,4 +440,4 @@ infoFromArray4 (Array fptr1) op =
439440 (,,,) <$> peek ptrInput1
440441 <*> peek ptrInput2
441442 <*> peek ptrInput3
442- <*> peek ptrInput4
443+ <*> peek ptrInput4
Original file line number Diff line number Diff line change @@ -10,12 +10,8 @@ spec =
1010 it " Should get features number an array" $ do
1111 let feats = createFeatures 10
1212 getFeaturesNum feats `shouldBe` 10
13- -- it "Should retain features" $ do
14- -- let feats = createFeatures 100
15- -- retainFeatures feats
16- -- print (getFeaturesSize feats)
17- -- print (getFeaturesOrientation feats)
18- -- print (getFeaturesXPos feats)
19- -- print (getFeaturesXPos feats)
20- -- scalar @Int 10 `shouldBe` scalar @Int 10
13+ -- print (getFeaturesSize feats)
14+ -- print (getFeaturesOrientation feats)
15+ -- print (getFeaturesXPos feats)
16+ -- print (getFeaturesYPos feats)
2117
You can’t perform that action at this time.
0 commit comments