Skip to content

Commit

Permalink
ObjC Blocks: Fix SIGSEV in test where panic was expected.
Browse files Browse the repository at this point in the history
  • Loading branch information
James Welch committed Jul 18, 2024
1 parent e7d3e21 commit c4394b5
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions objc/objc_block_darwin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,12 @@ func TestBlockCopyAndBlockRelease(t *testing.T) {
t.Parallel()

refCount := 0
defer func() {
if refCount != 0 {
t.Fatalf("refCount: %d != 0", refCount)
}
}()

block := objc.NewBlock(
func(objc.Block) {
refCount++
},
)
defer block.Release()
refCount++

copies := make([]objc.Block, 17)
Expand All @@ -184,13 +179,4 @@ func TestBlockCopyAndBlockRelease(t *testing.T) {
if refCount != 1 {
t.Fatalf("refCount: %d != 1", refCount)
}
block.Release()
refCount--

defer func() {
if recover() == nil {
t.Fatal("Block.Release(): function was not released on refCount == 0")
}
}()
block.Invoke()
}

0 comments on commit c4394b5

Please sign in to comment.